I have a XUL menuitem element that uses the insertafter attribute to position itself behind a specific context-menu item. There is one edge case for which I would like to reposition my menu item. If I dynamically alter the insertafter attribute using JavaScript, will the position of my item automatically reposition itself the next time the context menu is displayed? Or does insertafter only get applied during chrome initialization?
The documentation states:
This value may be a comma-separated list of ids, which are scanned and
the first one found in the window is used.
However, in my case, both IDs that I could possible use are physically present (one or the other is simply collapsed, depending on the circumstance). As such, a comma-separated list won’t help me.
No, the overlay applies when the window loads – changing
insertafterattribute after that won’t do anything at all, this attribute has no special meaning then. You should use the usual DOM methods, along these lines: