The compareDocumentPosition check was extraneous - indexOf works in all the other browsers that we need to support.
This commit is contained in:
parent
6f4b08cdf9
commit
782b4af76e
|
@ -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 ) {
|
||||||
}
|
}
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue