DOMAssistant fix for addEvent method peculiarity in IE

I don’t know why, but problems seem to always be especially good at showing their ugly face at work in Friday afternoons/evenings. This time around, IE (big f**king surprise) displayed an odd behavior when using the addEvent method on the window object.

For some reason, when calling the addEvent method, the keyword this was some weird object that wasn’t equal to the window object when comparing them (this happened only in IE 6 and 7, but it had some shared values nevertheless), and it had a window property which was the actual window object…

The solution was to check for that funky property, and if it existed, apply the event to that instead:


if(typeof this.window == "object"){
    this.window["on" + evt] = DOMAssistant.handleEvent;
}

Therefore, I’ve updated the code in the DOMAssistantEvents.js file and also in the All DOMAssistant modules ZIP file, so if you use DOMAssistant (which I highly recommend 🙂 ), just do an update and things should be fine. If not, please don’t hesitate to let me know.

One Comment

Leave a Reply to DOMAss - The DOM assistant - Robert’s talk Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.