" in jQuery? A few years ago, Dean Edwards brought us this workaround to the document.onload problem. The I...">

What happened to hacking "<script defer>" in jQuery?

A few years ago, Dean Edwards brought us this workaround to the document.onload problem. The IE version for the solution involved adding this fragment to the document:

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

Dean was also pretty sure that this was the closest excellence solution he could find and rejected any solution in which the onreadystatechange attribute was unreliable (see comments).

Subsequent refinements in his solution still affect some version of <script defer> and most JS frameworks have implemented it, including jQuery.

Today I am browsing the source of jQuery 1.4.1 and I cannot find it.

At what point did he fall and why?

+6
javascript jquery javascript-events
source share
1 answer

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

An Internet Explorer document is ready to go. We use a new technique inspired by Diego Perini. This allows us to no longer do document.write() , which is really fantastic.

Here is version 1.2.1 vs version 1.2.2 .

The main motivation was to remove document.write and avoid a problem with IE that runs ready too early, so it is now completely rewritten to listen onreadystatechange (in IE) and return to window.onload if all else fails.

+4
source share

All Articles