Skip to content
Permalink
Browse files

Make sure that document.body exists, at least, in IE before the ready…

… event is fired. Fixes #5443.
  • Loading branch information
jeresig committed Nov 7, 2009
1 parent 513053d commit 81bfd9b870f658ce00eec48ea48a84d69c20bf05
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/event.js
@@ -822,7 +822,8 @@ function bindReady() {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", function() {
if ( document.readyState === "complete" ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" && document.body ) {
document.detachEvent( "onreadystatechange", arguments.callee );
jQuery.ready();
}

3 comments on commit 81bfd9b

@jdalton

This comment has been minimized.

Copy link
Member

jdalton replied Nov 7, 2009

The issue http://dev.jquery.com/ticket/5443 presented more than 1 issue with 0 reproducible tests. How would this fix the FF issue (which the ticket is about) if this is in the document.attachEvent branch ? The IE issue wasn't attributed to style sheet order and while this addition is harmless I would dig seeing an actual reproducible test to verify the issue before just throwing code at it.

@jeresig

This comment has been minimized.

Copy link
Member Author

jeresig replied Nov 9, 2009

Good catch - I backed it out, found a test case, and fixed it.

@jdalton

This comment has been minimized.

Copy link
Member

jdalton replied Nov 9, 2009

awesome :D

Please sign in to comment.
You can’t perform that action at this time.