git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Provide a graceful failover for [name=foo] queries that are looking for non-input...
[jquery.git]
/
src
/
selector.js
diff --git
a/src/selector.js
b/src/selector.js
index
bc898e1
..
ecec83b
100644
(file)
--- a/
src/selector.js
+++ b/
src/selector.js
@@
-333,8
+333,9
@@
var Expr = Sizzle.selectors = {
}
},
NAME: function(match, context, isXML){
}
},
NAME: function(match, context, isXML){
- if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
- return context.getElementsByName(match[1]);
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = context.getElementsByName(match[1]);
+ return ret.length === 0 ? null : ret;
}
},
TAG: function(match, context){
}
},
TAG: function(match, context){
@@
-663,15
+664,18
@@
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;
}
return ret;
};
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
-} else if ( document.documentElement.sourceIndex === 0 ) {
+} else if ( document.documentElement.sourceIndex === 1 ) {
sortOrder = function( a, b ) {
var ret = a.sourceIndex - b.sourceIndex;
if ( ret === 0 ) {
sortOrder = function( a, b ) {
var ret = a.sourceIndex - b.sourceIndex;
if ( ret === 0 ) {