diff --git a/src/selector.js b/src/selector.js index dd050659..ecec83b9 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){ diff --git a/test/index.html b/test/index.html index 2c3545f0..c415d11c 100644 --- a/test/index.html +++ b/test/index.html @@ -121,8 +121,8 @@ -