mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Brought back the compareDocumentPosition code. While it is redundant in Firefox it's much faster than using indexOf.
This commit is contained in:
@@ -684,7 +684,15 @@ try {
|
||||
|
||||
var sortOrder;
|
||||
|
||||
if ( Array.prototype.indexOf ) {
|
||||
if ( document.documentElement.compareDocumentPosition ) {
|
||||
sortOrder = function( a, b ) {
|
||||
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
|
||||
if ( ret === 0 ) {
|
||||
hasDuplicate = true;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
} else if ( Array.prototype.indexOf ) {
|
||||
var indexOf = Array.prototype.indexOf,
|
||||
allSort = document.getElementsByTagName("*");
|
||||
|
||||
@@ -695,7 +703,7 @@ if ( Array.prototype.indexOf ) {
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
} else if ( document.documentElement.sourceIndex === 1 ) {
|
||||
} else if ( "sourceIndex" in document.documentElement ) {
|
||||
sortOrder = function( a, b ) {
|
||||
var ret = a.sourceIndex - b.sourceIndex;
|
||||
if ( ret === 0 ) {
|
||||
|
||||
Reference in New Issue
Block a user