Commit 0ce47c5
committed
Fix a selector parsing bug
Parsing e.g. `:is(:is(foo))` (as a selector) does not consume the last `)`, which is obviously erroneous behaviour.
The bug stems from the body of the `parse_any_value` procedure in the `selectors` module which does not increment the counter number corresponding to parentheses when encountering a function token (which features these). With the wrong counter value, the first subsequently encountered `)` token (a `CloseParenToken`) would break the `any-value` parsing procedure before the latter token is consumed, as it would be considered "non-matching" (borrowing the term from the "Selectors" spec.).
This change fixes the issue by adding a `case` for `FunctionToken`, and supplements it all with an additional test, that was missing as well (meaning lack of coverage hid the issue all up until now, unfortunately).1 parent caea4bc commit 0ce47c5
2 files changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
0 commit comments