mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Core: Remove private copies of push, sort & splice from the jQuery prototype
Closes gh-4473
This commit is contained in:
parent
78420d427c
commit
b59107f5d7
@ -120,13 +120,7 @@ jQuery.fn = jQuery.prototype = {
|
|||||||
|
|
||||||
end: function() {
|
end: function() {
|
||||||
return this.prevObject || this.constructor();
|
return this.prevObject || this.constructor();
|
||||||
},
|
}
|
||||||
|
|
||||||
// For internal use only.
|
|
||||||
// Behaves like an Array's method, not like a jQuery method.
|
|
||||||
push: push,
|
|
||||||
sort: arr.sort,
|
|
||||||
splice: arr.splice
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.extend = jQuery.fn.extend = function() {
|
jQuery.extend = jQuery.fn.extend = function() {
|
||||||
|
@ -190,7 +190,7 @@ function find( selector, context, results, seed ) {
|
|||||||
// Document context
|
// Document context
|
||||||
if ( nodeType === 9 ) {
|
if ( nodeType === 9 ) {
|
||||||
if ( ( elem = context.getElementById( m ) ) ) {
|
if ( ( elem = context.getElementById( m ) ) ) {
|
||||||
results.push( elem );
|
push.call( results, elem );
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ function find( selector, context, results, seed ) {
|
|||||||
if ( newContext && ( elem = newContext.getElementById( m ) ) &&
|
if ( newContext && ( elem = newContext.getElementById( m ) ) &&
|
||||||
jQuery.contains( context, elem ) ) {
|
jQuery.contains( context, elem ) ) {
|
||||||
|
|
||||||
results.push( elem );
|
push.call( results, elem );
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1426,7 +1426,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
|||||||
}
|
}
|
||||||
while ( ( matcher = elementMatchers[ j++ ] ) ) {
|
while ( ( matcher = elementMatchers[ j++ ] ) ) {
|
||||||
if ( matcher( elem, context || document, xml ) ) {
|
if ( matcher( elem, context || document, xml ) ) {
|
||||||
results.push( elem );
|
push.call( results, elem );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../var/document"
|
"../var/document",
|
||||||
], function( jQuery, document ) {
|
"../var/sort"
|
||||||
|
], function( jQuery, document, sort ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ jQuery.uniqueSort = function( results ) {
|
|||||||
|
|
||||||
hasDuplicate = false;
|
hasDuplicate = false;
|
||||||
|
|
||||||
results.sort( sortOrder );
|
sort.call( results, sortOrder );
|
||||||
|
|
||||||
if ( hasDuplicate ) {
|
if ( hasDuplicate ) {
|
||||||
while ( ( elem = results[ i++ ] ) ) {
|
while ( ( elem = results[ i++ ] ) ) {
|
||||||
|
7
src/var/sort.js
Normal file
7
src/var/sort.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
define( [
|
||||||
|
"./arr"
|
||||||
|
], function( arr ) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
return arr.sort;
|
||||||
|
} );
|
Loading…
Reference in New Issue
Block a user