Corrected addEvent function

Most of my unobtrusive DHTML scripts use the addEvent function, which has been copied from all over the place. The Opera people have very kindly dropped me a mail to tell me that it’s wrong; it uses the line

obj.addEventListener(evType, fn, true);

when instead that line should be

obj.addEventListener(evType, fn, false);

The “true” and “false” bits relate to whether the event is “capturing” or not. Firefox has a bug where it treats “capturing” and “non capturing” the same here, meaning that it doesn’t matter whether you use true or false. That’s wrong. The Opera people have got it right, but are understandably a bit worried that no-one will believe them, so they’re mailing people to ask them to update scripts. (Hallvord has more on this.) So, I’ve updated all my old scripts to use the fixed addEvent. (Newer scripts use the better all-new addEvent and aren’t affected.) If you use any of my older scripts, in particular NiceTitles, aqdropshadow, JSES, or aqtree3) then please take an updated version from here. Thanks to Opera for letting me know!

More in the discussion (powered by webmentions)

  • (no mentions, yet.)