A picture of me taking it easy

I'm currently on parental leave till September. During that time, I will not read any e-mail or blog comments.

Until I'm back, please read through my archives, take a look at my code/applications and check out my pictures.

Have a great summer, and a splendid winter to you aussies and kiwis! :-)

DOMAssistant fix for addEvent method peculiarity in IE

Published on Friday, May 11th, 2007

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

Share your thoughts:

HTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> . If you want to display code examples, please remember to write &lt; for < and &gt; for >.

Comment preview

All the proceeds from ad clicks will go to charity. However, if you like to give something directly to charity yourself, I recommend choosing from the listed ones below.

  • Save the Children
  • Red Cross
  • Cancer Research UK
  • WWF

Top results