RESOLVED FIXED Bug 74178
Add new CSS nth-children parsing tests
https://bugs.webkit.org/show_bug.cgi?id=74178
Summary Add new CSS nth-children parsing tests
Zoltan Herczeg
Reported 2011-12-09 06:20:34 PST
The test covers several valid and invalid nth-child tokens.
Attachments
patch (6.90 KB, patch)
2011-12-09 06:45 PST, Zoltan Herczeg
darin: review+
zherczeg: commit-queue-
Zoltan Herczeg
Comment 1 2011-12-09 06:45:24 PST
Darin Adler
Comment 2 2011-12-09 09:35:25 PST
Comment on attachment 118570 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=118570&action=review > Source/WebCore/css/CSSParser.cpp:8092 > // The tokenizer checks for the construct of an+b. > // nth can also accept "n", "odd" or "even" but should not accept any other token. > - return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") || equalIgnoringCase(token, "n"); > + return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") > + || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); The comment now does not match the code. There is no clue here why "-n" is something we need to allow here.
Zoltan Herczeg
Comment 3 2011-12-09 10:04:17 PST
> The comment now does not match the code. There is no clue here why "-n" is something we need to allow here. Thanks for the review. I'll fix the comment and land manually.
Darin Adler
Comment 4 2011-12-09 10:06:14 PST
When fixing the comment I suggest removing the part that says what the code does, since the code already seems to say that clearly enough, and enhancing the aspect of comment that says *why* the code does what it does.
Zoltan Herczeg
Comment 5 2011-12-11 23:45:53 PST
Changed the comment to: // The tokenizer checks for the construct of an+b. // However, since the {ident} rule precedes the {nth} rule, some of those // tokens are identified as string literal. Furthermore we need to accept // "odd" and "even" which does not match to an+b. And landed: http://trac.webkit.org/changeset/102560
Note You need to log in before you can comment on or make changes to this bug.