Commit 782b4af7 authored by John Resig's avatar John Resig

The compareDocumentPosition check was extraneous - indexOf works in all the...

The compareDocumentPosition check was extraneous - indexOf works in all the other browsers that we need to support.
parent 6f4b08cd
...@@ -663,9 +663,12 @@ try { ...@@ -663,9 +663,12 @@ try {
var sortOrder; var sortOrder;
if ( document.documentElement.compareDocumentPosition ) { if ( Array.prototype.indexOf ) {
var indexOf = Array.prototype.indexOf,
allSort = document.getElementsByTagName("*");
sortOrder = function( a, b ) { 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 ) { if ( ret === 0 ) {
hasDuplicate = true; hasDuplicate = true;
} }
...@@ -679,17 +682,6 @@ if ( document.documentElement.compareDocumentPosition ) { ...@@ -679,17 +682,6 @@ if ( document.documentElement.compareDocumentPosition ) {
} }
return ret; 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 // Check to see if the browser returns elements by name when
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment