Skip to content
Permalink
Browse files

The compareDocumentPosition check was extraneous - indexOf works in a…

…ll the other browsers that we need to support.
  • Loading branch information
jeresig committed Feb 14, 2009
1 parent 6f4b08c commit 782b4af76ec080aad93d5c4a15fbc805f3e5960e
Showing with 5 additions and 13 deletions.
  1. +5 −13 src/selector.js
@@ -663,9 +663,12 @@ try {

var sortOrder;

if ( document.documentElement.compareDocumentPosition ) {
if ( Array.prototype.indexOf ) {
var indexOf = Array.prototype.indexOf,
allSort = document.getElementsByTagName("*");

sortOrder = function( a, b ) {
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
var ret = indexOf.call( allSort, a ) - indexOf.call( allSort, b );
if ( ret === 0 ) {
hasDuplicate = true;
}
@@ -679,17 +682,6 @@ if ( document.documentElement.compareDocumentPosition ) {
}
return ret;
};
} else if ( Array.prototype.indexOf ) {
var indexOf = Array.prototype.indexOf,
allSort = document.getElementsByTagName("*");

sortOrder = function( a, b ) {
var ret = indexOf.call( allSort, a ) - indexOf.call( allSort, b );
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
}

// Check to see if the browser returns elements by name when

0 comments on commit 782b4af

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