X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fselector.js;h=4177672eb57527dc77dfeb34c4484c66f0238a8a;hb=22c9c9b9d31933a3615892a3796f5d9d75bac104;hp=ecec83b9fccc833a39135974e754ebf5ee2bec3b;hpb=21dde30348fe9bcbd8db8c1b30e470a9e2f39c16;p=jquery.git diff --git a/src/selector.js b/src/selector.js index ecec83b..4177672 100644 --- a/src/selector.js +++ b/src/selector.js @@ -223,8 +223,6 @@ Sizzle.filter = function(expr, set, inplace, not){ } } - expr = expr.replace(/\s*,\s*/, ""); - // Improper expression if ( expr == old ) { if ( anyFound == null ) { @@ -334,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; } }, @@ -399,7 +404,7 @@ var Expr = Sizzle.selectors = { PSEUDO: function(match, curLoop, inplace, result, not){ if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one - if ( match[3].match(chunker).length > 1 ) { + if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);