RESOLVED FIXED 51231
document.querySelector(':nth-child(foo)') should throw a syntax error
https://bugs.webkit.org/show_bug.cgi?id=51231
Summary document.querySelector(':nth-child(foo)') should throw a syntax error
temp01
Reported 2010-12-16 20:32:01 PST
See http://code.google.com/p/chromium/issues/detail?id=67256 document.querySelector(':nth-child(foo)') should throw a SYNTAX_ERR DOM Exception like document.querySelector(':nth-child(2foo)') does -- but instead, it just returns null and moves on.
Attachments
Patch (12.85 KB, patch)
2011-01-06 05:58 PST, Yael
darin: review+
Yael
Comment 1 2011-01-06 05:58:56 PST
Created attachment 78110 [details] Patch Add a check in the parser that nth selectors can only accept an+b, odd or even as parameters.
Darin Adler
Comment 2 2011-01-06 08:16:38 PST
Comment on attachment 78110 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=78110&action=review > WebCore/css/CSSGrammar.y:1212 > + } > + else WebKit project style is to put the else on the same line as the close brace. > WebCore/css/CSSParser.h:82 > + bool isValidNthToken(const CSSParserString&); This should be a static member function. There is no dependency here on the parser state, so no need for a non-static member function.
Yael
Comment 3 2011-01-06 08:48:02 PST
Note You need to log in before you can comment on or make changes to this bug.