[Project_owners] Conflicting Event Listeners

Myk Melez myk at melez.com
Thu Jun 9 19:37:59 EDT 2005


Frank wrote:

> popup menus *are* different if some random js code modifies the 
> onpopupshowing attribute of the popup menu..
>
> so, if one extension setAttribute's that onpopupshowing to 'foobar();' 
> and another extension setAttribute's that same onpopupshowing to 
> 'foofoobar();' then whatever extension was 'last' to set the attribute 
> will have its handler called..
>
> That's why I consider it dangerous to modify an onpopupshowing 
> attribute of an element that the extension itself did not add..

Right.  Presumably the solution would be to use addEventListener() to 
attach your event handler to the element, i.e. something like:

theElement.addEventListener("popupshowing", yourFunction, false);

-myk



More information about the Project_owners mailing list