Skip to content
Permalink
Browse files

reduce complexity of ready further, and try manipulating DOM to make …

…sure we're really ready
  • Loading branch information...
mikesherov committed May 4, 2012
1 parent f925c7a commit 714b8ffd2b28af446fea8f25e369597d7c509cb4
Showing with 7 additions and 7 deletions.
  1. +5 −7 src/core.js
  2. +1 −0 test/data/event/asyncReady.html
  3. +1 −0 test/data/event/syncReady.html
@@ -59,18 +59,16 @@ var jQuery = function( selector, context ) {
// The deferred used on DOM ready
readyList,

// The ready event handler
// Cleanup function for the document ready method
// The ready event handler and self cleanup method
DOMContentLoaded = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
} else if ( document.readyState !== "loading" ) {
// if document.addEventListener isn't present, we assume detachEvent is!
// Make sure body exists by checking readystate, at least, in case IE gets a little overzealous (ticket #5443).
} else {
// we're here because readyState !== "loading" in oldIE
// which is good enough for us to call the dom ready!
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
jQuery.ready();
},

// Save a reference to some core methods
@@ -14,6 +14,7 @@
el.type = "text/javascript";
el.onload = function() {
jQuery( document ).ready(function() {
jQuery("body").append("<div>modifying DOM</div>");
window.parent.iframeCallback( true );
});
}
@@ -8,6 +8,7 @@
<body>
<script type="text/javascript">
jQuery( document ).ready(function () {
jQuery("body").append("<div>modifying DOM</div>");
window.parent.iframeCallback( true );
});
</script>

0 comments on commit 714b8ff

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