Skip to content
Permalink
Browse files

Core: Do not run window.onready when ready

Fixes #14802
  • Loading branch information
dmethvin committed Mar 4, 2014
1 parent f4b37d8 commit 2df1aad6a1c9376c2a477eba26ee992113ed1c23
Showing with 34 additions and 2 deletions.
  1. +3 −2 src/core/ready.js
  2. +24 −0 test/data/core/onready.html
  3. +7 −0 test/unit/core.js
@@ -51,8 +51,9 @@ jQuery.extend({
readyList.resolveWith( document, [ jQuery ] );

// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
if ( jQuery.fn.triggerHandler ) {
jQuery( document ).triggerHandler( "ready" );
jQuery( document ).off( "ready" );
}
}
});
@@ -0,0 +1,24 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>alias-masked DOM properties (#14074)</title>
<script>
var error = false;
window.onready = function() { error = "Called window.onready"; };
</script>
<script src="../../jquery.js"></script>
</head>
<body>
<form>
<input type="text" id="nodeName"/>
</form>
<script>
jQuery(function() {
setTimeout( function() {
window.parent.iframeCallback( error );
});
});
</script>
</body>
</html>
@@ -1516,3 +1516,10 @@ testIframeWithCallback( "Tolerating alias-masked DOM properties (#14074)", "core
deepEqual( errors, [], "jQuery loaded" );
}
);

testIframeWithCallback( "Don't call window.onready (#14802)", "core/onready.html",
function( error ) {
expect( 1 );
equal( error, false, "no call to user-defined onready" );
}
);

0 comments on commit 2df1aad

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