« Return to Thread: Using defer to Stop onDOMReady Problems with Internet Explorer?

Using defer to Stop onDOMReady Problems with Internet Explorer?

by wrumsby :: Rate this Message:

Reply to Author | View in Thread

Every now and then a message pops up on the mailing list suggesting
problems with onDOMReady in Internet Explorer. One of our product
teams has also experienced some problems. Unfortunately it seems
impossible to find a test case that demonstrates the problem, which
makes it pretty difficult to submit a useful bug (I could never work
out what was causing the problems we saw and the solution used was to
listen for the window load event instead).

It occurred to me that you could take advantage of the defer attribute
here (assuming your entire script is wrapped inside an onDOMReady
function) and that would effectively sidestep the issue for IE.

As an example:

http://www.rumsby.net/walter/examples/yui/defer.html

Now unfortunately this isn't a page that would have problems with
onDOMReady in IE anyway, but it appears to support my hunch.

What do people think of this technqiue? Pros? Cons? Thoughts? If
anyone has the IE onDOMReady problem, does this solve it?

 « Return to Thread: Using defer to Stop onDOMReady Problems with Internet Explorer?