From: Dave Methvin Date: Tue, 4 Mar 2014 03:04:23 +0000 (-0500) Subject: Core: Do not run window.onready when ready X-Git-Tag: 2.1.1-beta1~37 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2df1aad6a1c9376c2a477eba26ee992113ed1c23;p=jquery.git Core: Do not run window.onready when ready Fixes #14802 --- diff --git a/src/core/ready.js b/src/core/ready.js index e64977cd9..122b1610d 100644 --- a/src/core/ready.js +++ b/src/core/ready.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" ); } } }); diff --git a/test/data/core/onready.html b/test/data/core/onready.html new file mode 100644 index 000000000..1e8f127e7 --- /dev/null +++ b/test/data/core/onready.html @@ -0,0 +1,24 @@ + + + + + alias-masked DOM properties (#14074) + + + + +
+ +
+ + + \ No newline at end of file diff --git a/test/unit/core.js b/test/unit/core.js index 6801c7c0d..d1b221ce8 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -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" ); + } +);