Add relative selector parsing for :has(> a)
Categories
(Core :: CSS Parsing and Computation, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: tlouw, Assigned: dshin)
References
Details
Attachments
(1 file)
The :has selector only parses combinator selectors that has a type selector, e.g. p > a
, but supports syntax like: :has(> a)
which doesn't have the type selector.
Suggested fix is to fake the selector that is parsed to prepend the type of the :has
element
Reporter | ||
Updated•3 years ago
|
Reporter | ||
Updated•3 years ago
|
Comment 1•2 years ago
|
||
(In reply to Tiaan Louw from comment #0)
Suggested fix is to fake the selector that is parsed to prepend the type of the
:has
element
Sorry for my ignorance as I have no idea how the parser actually works, but doesn't parsing relative selectors mean to start parsing expecting a combinator first?
Matching is a whole different beast, of course.
I'd expect it to work as if the selectors inside :has()
wheren't surrounded by it. E.g. p:has(> a, > .class) + p
would first match p > a
and p > .class
and remember the <p>
elements matched by them. Then p + p
is matched against the remembered p
s.
And is this bug meant to cover both or only the parsing?
Sebastian
Reporter | ||
Comment 2•2 years ago
•
|
||
My apologies, I admit my comment is a bit light on details.
Sorry for my ignorance as I have no idea how the parser actually works, but doesn't parsing relative selectors mean to start parsing expecting a combinator first?
We don't handle relative selectors normally, because of marching, so we need to make :has
an exception. Basically we plan to represent relative selector syntax by having a magic placeholder of sorts that represents the :has
scope, but we don't serialize it. It follows a similar pattern used for the ::slotted
selector.
And is this bug meant to cover both or only the parsing?
This would only be for the parsing part.
Comment hidden (advocacy) |
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
Comment 7•2 years ago
|
||
bugherder |
Description
•