Make sure that [name=FOO] searches actually have the specified name (IE includes...
[jquery.git] / src / selector.js
index f1745e4..4177672 100644 (file)
@@ -332,7 +332,14 @@ var Expr = Sizzle.selectors = {
                },
                NAME: function(match, context, isXML){
                        if ( typeof context.getElementsByName !== "undefined" ) {
-                               var ret = context.getElementsByName(match[1]);
+                               var ret = [], results = context.getElementsByName(match[1]);
+
+                               for ( var i = 0, l = results.length; i < l; i++ ) {
+                                       if ( results[i].getAttribute("name") === match[1] ) {
+                                               ret.push( results[i] );
+                                       }
+                               }
+
                                return ret.length === 0 ? null : ret;
                        }
                },