aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2022-08-29 19:03:12 +0200
committerGitHub <noreply@github.com>2022-08-29 19:03:12 +0200
commitd2436df36a4b2ef556907e734a90771f0dbdbcaf (patch)
tree30db31a61ee43b490a6f878209d6ca132b81483f
parent8cf39b78e6c36b360dd81268a7f84fb4ca218e15 (diff)
downloadjquery-d2436df36a4b2ef556907e734a90771f0dbdbcaf.tar.gz
jquery-d2436df36a4b2ef556907e734a90771f0dbdbcaf.zip
Core: Drop the root parameter of jQuery.fn.init
The third parameter of `jQuery.fn.init` - `root` - was just needed to support `jQuery.sub`. Since this API has been removed in jQuery 1.9.0 and Migrate 3.x is not filling it in, this parameter is no longer needed. This parameter has never been documented but it's safer to remove it in a major update. Closes gh-5096
-rw-r--r--src/core/init.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/init.js b/src/core/init.js
index 9fea5e6d4..4ac091054 100644
--- a/src/core/init.js
+++ b/src/core/init.js
@@ -15,7 +15,7 @@ var rootjQuery,
// Shortcut simple #id case for speed
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
- init = jQuery.fn.init = function( selector, context, root ) {
+ init = jQuery.fn.init = function( selector, context ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
@@ -23,10 +23,6 @@ var rootjQuery,
return this;
}
- // Method init() accepts an alternate rootjQuery
- // so migrate can support jQuery.sub (gh-2101)
- root = root || rootjQuery;
-
// HANDLE: $(DOMElement)
if ( selector.nodeType ) {
this[ 0 ] = selector;
@@ -36,8 +32,8 @@ var rootjQuery,
// HANDLE: $(function)
// Shortcut for document ready
} else if ( typeof selector === "function" ) {
- return root.ready !== undefined ?
- root.ready( selector ) :
+ return rootjQuery.ready !== undefined ?
+ rootjQuery.ready( selector ) :
// Execute immediately if ready is not present
selector( jQuery );
@@ -108,7 +104,7 @@ var rootjQuery,
// HANDLE: $(expr) & $(expr, $(...))
} else if ( !context || context.jquery ) {
- return ( context || root ).find( selector );
+ return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)