views:

48

answers:

1

A few years ago Dean Edwards brought us this workaround to the document.onload problem. The IE version of the solution involved appending this snippet to the document:

<script defer src=ie_onload.js><\/script>;

Dean was also pretty adamant on the fact that this was the closest solution to perfection he could find and dismissed any solution that involved the onreadystatechange attribute as being unreliable (see comments).

Subsequent refinements on his solution still involved some version of <script defer> and most JS framework implemented it, including jQuery.

Today, I'm perusing JQuery 1.4.1's source and I can't find it.

At which point was it dropped and why?

+3  A: 

It was removed in the jQuery 1.2.2 release, you can find the release notes here.

Internet Explorer document ready drastically improved. We use a new technique inspired by Diego Perini. It allows us to not have to do a document.write() anymore, which is really fantastic.

Here's the 1.2.1 Version vs the 1.2.2 version.

The main motivation was to remove the document.write and avoid the problem of IE still triggering the ready a bit too early, so now it's completely rewritten to listen to onreadystatechange (in IE) and fall-back to window.onload if all else fails.

Nick Craver