-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[selectors-4] Should :has()
be a complex selector?
#10756
Comments
Or, given that the Then it seems that this edit proposal in #5093 (comment) may cover the
Based on the assumption that the above statement will be applied to the |
I'm not suggesting the analysis here is incorrect (based on #7953), but from a developer perspective, yes, it should be complex and it should definitely match inside The We need less, not more styling restrictions for Shadow DOM styling. Right now
What developers who actually use Shadow DOM beg for is Safari's behavior. Please clarify the spec to clearly support this. And Safari's implementation seems like an existence proof that the implementation is doable. |
echo @sorvell here. I definitely think that ironing out the behavior of :has with the :host selector so that a) it’s consistent, b) powerful even in shadow root styles, and c) super flexible as well are all good things. right now all we really have for styling light dom elements from inside shadow roots is ::slotted() and there are definitely problems with that already. if we could add :has alongside that would definitely help alleviate some of the problems of ::slotted |
@sorvell: What I tried to clarify in this issue is not about the
Chrome and Firefox follow the agreement in #5093 (comment) that passes restrictions to the argument of logical combinations. So But it seems that there is a conflict between Firefox and Chrome on Firefox allows Chrome doesn't allow I think that, clarifying this conflict would be helpful for the general discussion of |
I would say that the I would go further to day that this restriction and the same on |
I can fully understand that there are requirements of using In the perspective of spec reader, I thought that there might be a grey area on applying the This is how I understood the confusion so far:
Among the above steps, I wanted to clarify the step 2 (how to read I thought about adding a short note in the And I thought that this will not affect further discussions about |
I cannot say if/how this can be improved but the
|
Oh right. It's already very clearly stated in the live version! Thanks @cdoublev for sharing! I'm closing this issue as there seem to be no arguable point on how to read the ':has()' argument. |
This is a follow-up question about the validity of
:host(<selector>)
argument (csswg-drafts/issues/7953) and the wpt pull request that adds tests for:host(:has(section))
case (web-platform-tests/wpt/pull/47441).Given the fact that
:has()
represents a relationship between multiple elements, it seems reasonable to treat a selector containing:has()
as a complex selector even if the selector is a form of compound selector. (e.g..a:has(.b)
)The spec describes that compound selector represents conditions on a single element and complex selector represents relationships between multiple elements:
If it makes sense, I think it might be helpful to add a comment to the complex (or compound) selector description that says that even if
:has()
describes a 'has-descendant' relationship (e.g.,:has(.a)
) which doesn't have an explicit combinator, it is a complex selector because of the implicit descendant relationship between the anchor element and the subject of the argument.The text was updated successfully, but these errors were encountered: