aboutsummaryrefslogtreecommitdiffstats
path: root/src/selector.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-02-14 22:24:55 +0000
committerJohn Resig <jeresig@gmail.com>2009-02-14 22:24:55 +0000
commit21dde30348fe9bcbd8db8c1b30e470a9e2f39c16 (patch)
tree0f01fb321c01b833ebb5bba62bda2590a06ae9da /src/selector.js
parent782b4af76ec080aad93d5c4a15fbc805f3e5960e (diff)
downloadjquery-21dde30348fe9bcbd8db8c1b30e470a9e2f39c16.tar.gz
jquery-21dde30348fe9bcbd8db8c1b30e470a9e2f39c16.zip
Provide a graceful failover for [name=foo] queries that are looking for non-input/iframe/form elements. Fixes jQuery bug #4081.
Diffstat (limited to 'src/selector.js')
-rw-r--r--src/selector.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/selector.js b/src/selector.js
index dd0506598..ecec83b9f 100644
--- a/src/selector.js
+++ b/src/selector.js
@@ -333,8 +333,9 @@ var Expr = Sizzle.selectors = {
}
},
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){