git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6f4b08c
)
The compareDocumentPosition check was extraneous - indexOf works in all the other...
author
John Resig
<jeresig@gmail.com>
Sat, 14 Feb 2009 22:18:02 +0000
(22:18 +0000)
committer
John Resig
<jeresig@gmail.com>
Sat, 14 Feb 2009 22:18:02 +0000
(22:18 +0000)
src/selector.js
patch
|
blob
|
history
diff --git
a/src/selector.js
b/src/selector.js
index
6b3b2da
..
dd05065
100644
(file)
--- a/
src/selector.js
+++ b/
src/selector.js
@@
-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 ) {
hasDuplicate = true;
}
if ( ret === 0 ) {
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