Skip to content
Permalink
Browse files

Expose the sort/unique code from Sizzle as Sizzle.uniqueSort().

  • Loading branch information...
jeresig committed Feb 25, 2009
1 parent 85e0945 commit 1c5db3babaf32f6faa7e9e867990110c9713f64b
Showing with 13 additions and 10 deletions.
  1. +13 −10 src/selector.js
@@ -124,22 +124,25 @@ var Sizzle = function(selector, context, results, seed) {

if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}

if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
return results;
};

if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
Sizzle.uniqueSort = function(results){
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);

if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}

return results;
};

Sizzle.matches = function(expr, set){

0 comments on commit 1c5db3b

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