Allow :host
and :host-context
to take selectors…
#58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…as well as
:nth-child
and:nth-last-child
.Fixes #57.
This was prompted by #57 and I wanted to fix it while it was still in my head. I got bitten by the other thing that this PR fixes…
…where
li.important
is parsed as aplain_value
instead of as aselector
.This is another quick fix that avoids a larger reckoning with pseudoclass arguments. It's hard to say whether the CSS spec has any sort of predictable limitation in mind for what can be a valid argument to a pseudoclass; the ones we've whitelisted are those that take CSS selectors, but among the others it's generally a one-off set of valid values that varies per pseudoclass. For example:
en
,en-US
)rtl
orltr
:nth-child
, but without the optional filtering selector that the latter has —even
,odd
,4
,-n
,2n+1
are all valid valuesIn theory, we could get away with a minimal approach:
plain_value
In practice, we go a bit further than this; for instance, I think the
4
in:nth-child(4)
would get parsed as aninteger_value
, which is fine.As I describe in #57, the holy grail here would be to prevent
plain_value
from precluding selector detection while lexing, but I haven't figured that out yet. Until we do, the best approach is to manually handle each pseudoclass that can take a selector to prevent scenarios where bothselector
andplain_value
are valid lexing options.I forget what the right hygiene is these days around committing generated files, so let me know if I've done this wrong and I'll amend it.