Monday, July 14, 2008

domready event is buggy in IE

Problem:
IE intermittently throws an "Operation Aborted" alert when "domready" event is used and then crashes.

Solution:
Evidently, IE throws the "domready" event before the DOM is actually ready. Consequently, if the function called by the "domready" event does DOM manipulation, IE will panic since DOM isn't ready yet and throws an error.

It's recommended to always use the window "load" event in IE. If you're using YUI, it's also better not to use onAvailable/onContentReady since they are triggered when "domready" event is triggered.

No comments:

Blog Archive