Skip to content
Browse files

Revert "Removed the need for the results set to have array methods. R…

…esolves jQuery bug #4250."

This reverts commit 6ced937.
  • Loading branch information...
1 parent db1e52d commit 67551ef3a99ea683ec10f8f543c2fa6be9346c34 @jeresig jeresig committed Mar 17, 2009
Showing with 7 additions and 10 deletions.
  1. +7 −10 sizzle.js
View
17 sizzle.js
@@ -8,10 +8,7 @@
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
- toString = Object.prototype.toString,
- arraySplice = Array.prototype.splice,
- arrayPush = Array.prototype.push,
- arraySort = Array.prototype.sort;
+ toString = Object.prototype.toString;
var Sizzle = function(selector, context, results, seed) {
results = results || [];
@@ -107,17 +104,17 @@ var Sizzle = function(selector, context, results, seed) {
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
- arrayPush.apply( results, checkSet );
+ results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
- arrayPush.call( results, set[i] );
+ results.push( set[i] );
}
}
} else {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- arrayPush.call( results, set[i] );
+ results.push( set[i] );
}
}
}
@@ -136,12 +133,12 @@ var Sizzle = function(selector, context, results, seed) {
Sizzle.uniqueSort = function(results){
if ( sortOrder ) {
hasDuplicate = false;
- arraySort.call(results, sortOrder);
+ results.sort(sortOrder);
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
- arraySplice.call(results, i--, 1);
+ results.splice(i--, 1);
}
}
}
@@ -666,7 +663,7 @@ var makeArray = function(array, results) {
array = Array.prototype.slice.call( array );
if ( results ) {
- arrayPush.apply( results, array );
+ results.push.apply( results, array );
return results;
}

0 comments on commit 67551ef

Please sign in to comment.
Something went wrong with that request. Please try again.