The ':has()' pseudo class is a selector that specifies an element which has at least one element that matches the relative selector passed as an argument.
Authors can easily
increase complexity of selector query or style invalidation by
using ':has()' pseudo classes.
Similar to the other traditional selector usages, these would be
helpful.
Regardless of the
above, we applied following approaches to prevent the risk of
having bad performance caused by using ':has()' inefficiently.
In addition to the
above, we have a plan of applying the bloom filter approach that
WebKit applies.
':has()' pseudo class is well supported by DevTools. 'Elements>Styles' tab correctly displays and updates the style rules with ':has()'. The rule-matched elements are successfully highlighted when mouse is over on a style rule with ':has()'. In Console drawer, developer can query (matches/querySelector/querySelectorAll/closest) with ':has()' pseudo class. Some cases were explicitly limited to prevent security risks or to avoid increasing complexity. It would be better to provide the author with the `:has()` feature and its coverage or limitations. Some kind of documentation in either MDN or web.dev about those would be welcome, and we're willing to help with that.
105
On 5/16/22 11:05, Byungwoo Lee wrote:
Anticipated spec changes
There are 4 open issues posted on the csswg draft.
* Remove scope dependency from relative selectors definition:
https://github.com/w3c/csswg-drafts/issues/6399
* Disallowing logical combination pseudo classes inside ':has()':
https://github.com/w3c/csswg-drafts/issues/6952
* Disallowing ':scope' inside ':has()':
https://github.com/w3c/csswg-drafts/issues/7211
* Disallowing ':host', ':host()', ':host-context()' inside ':has()':
https://github.com/w3c/csswg-drafts/issues/7212
It'd be great to get resolution on these issues before shipping, IMO.
In general, given how the usefulness of this feature relies on browser engines having predictable performance (the feature is useless if WebKit or Firefox get cases fast that Chrome gets slow or vice-versa), it'd be great to document in the spec some of these limitations and the reasoning for them.
All the above 4 issues are essentially related to the case of ':is()' inside ':has()'.
The dependency between the 4 issues can be summarized as follows:
The ':is()' inside ':has()' case is the start of the 4 issues, and
most engines seems to agree to disallow the ':is()' inside
':has()' case now.
If so, I think it would be OK to ship to Chrome with explicit
limitations for the above cases even if those issues are not yet
addressed in the spec. How do you think about this?
To be clear, in general I'd favor shipping with the limitations in place for now, and if/when there are use cases and so to unrestrict them do so. But that said, for that we need proper detection for those limitations. I filed this on the topic:
* https://github.com/w3c/csswg-drafts/issues/7280
Your suggestion to `@supports` seems to help detect the limitations, so I left a comment. Thank you for filing the issue!
-- Emilio
Regards,
Byungwoo
On Tuesday, May 17, 2022 at 9:19:03 AM UTC+3 bl...@igalia.com wrote:
On 5/17/22 03:17, Emilio Cobos Álvarez wrote:
On 5/16/22 11:05, Byungwoo Lee wrote:
Anticipated spec changes
There are 4 open issues posted on the csswg draft.
* Remove scope dependency from relative selectors definition:
https://github.com/w3c/csswg-drafts/issues/6399
* Disallowing logical combination pseudo classes inside ':has()':
https://github.com/w3c/csswg-drafts/issues/6952
* Disallowing ':scope' inside ':has()':
https://github.com/w3c/csswg-drafts/issues/7211
* Disallowing ':host', ':host()', ':host-context()' inside ':has()':
https://github.com/w3c/csswg-drafts/issues/7212
It'd be great to get resolution on these issues before shipping, IMO.
In general, given how the usefulness of this feature relies on browser engines having predictable performance (the feature is useless if WebKit or Firefox get cases fast that Chrome gets slow or vice-versa), it'd be great to document in the spec some of these limitations and the reasoning for them.
All the above 4 issues are essentially related to the case of ':is()' inside ':has()'.
The dependency between the 4 issues can be summarized as follows:
- To avoid increasing invalidation complexity, disallow ':is()' or ':where()' inside ':has()' (#6952)
- ':scope' inside ':has()' has the same (or worse) problem as ':is()' inside ':has()', so disallow ':scope' inside ':has()' (#7211)
- After ':scope' is disallowed inside ':has()', we can keep the current definition of absolutizing with ':scope' because ':scope' will not be used explicitly inside the ':has()' (#6399)
- ':host', ':host()', ':host-context()' is meaningless unless it is used with ':scope' inside ':has()' (#7212)
The ':is()' inside ':has()' case is the start of the 4 issues, and most engines seems to agree to disallow the ':is()' inside ':has()' case now.
If so, I think it would be OK to ship to Chrome with explicit limitations for the above cases even if those issues are not yet addressed in the spec. How do you think about this?
WebKit does not disallow :is() inside :has() and I don't see a particular reason to. While not very useful it does not increase complexity over :not() inside :has() (which is supported and people have found useful). The only current limitation with logical combinator pseudo-classes is disallowing :has() nested inside :has() (which increases complexity a lot without enabling anything useful).
antti
I think I misunderstood that the option of disallowing ':is()'
inside ':has()' is still alive. Also I overlooked that ':not()'
inside ':has()' has the same problem as ':is()' inside ':has()'.
I communicated with Antti about the above limitations, and we both agreed these:
Based on this consensus, I'm going to allow ':is()' and ':where()' inside ':has()' before shipping.
The bug pointed at above will not be fixed before
shipping.
Since it is positive to disallow explicit ':scope' inside
':has()', I think disallowing ':host()' inside ':has()' is still
reasonable.
How about this?
Byungwoo.
On 5/17/22 03:17, Emilio Cobos Álvarez wrote:
On 5/16/22 11:05, Byungwoo Lee wrote:
Anticipated spec changes
There are 4 open issues posted on the csswg draft.
* Remove scope dependency from relative selectors definition:
https://github.com/w3c/csswg-drafts/issues/6399
* Disallowing logical combination pseudo classes inside ':has()':
https://github.com/w3c/csswg-drafts/issues/6952
* Disallowing ':scope' inside ':has()':
https://github.com/w3c/csswg-drafts/issues/7211
* Disallowing ':host', ':host()', ':host-context()' inside ':has()':
https://github.com/w3c/csswg-drafts/issues/7212
It'd be great to get resolution on these issues before shipping, IMO.
In general, given how the usefulness of this feature relies on browser engines having predictable performance (the feature is useless if WebKit or Firefox get cases fast that Chrome gets slow or vice-versa), it'd be great to document in the spec some of these limitations and the reasoning for them.
All the above 4 issues are essentially related to the case of ':is()' inside ':has()'.
The dependency between the 4 issues can be summarized as follows:
- To avoid increasing invalidation complexity, disallow ':is()' or ':where()' inside ':has()' (#6952)
- ':scope' inside ':has()' has the same (or worse) problem as ':is()' inside ':has()', so disallow ':scope' inside ':has()' (#7211)
- After ':scope' is disallowed inside ':has()', we can keep the current definition of absolutizing with ':scope' because ':scope' will not be used explicitly inside the ':has()' (#6399)
- ':host', ':host()', ':host-context()' is meaningless unless it is used with ':scope' inside ':has()' (#7212)
The ':is()' inside ':has()' case is the start of the 4 issues, and most engines seems to agree to disallow the ':is()' inside ':has()' case now.
If so, I think it would be OK to ship to Chrome with explicit limitations for the above cases even if those issues are not yet addressed in the spec. How do you think about this?
To be clear, in general I'd favor shipping with the limitations in place for now, and if/when there are use cases and so to unrestrict them do so. But that said, for that we need proper detection for those limitations. I filed this on the topic:
* https://github.com/w3c/csswg-drafts/issues/7280
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/b8aba55a-2ea6-4b75-bf13-f04e27661938%40igalia.com.
There is an update!
Thank you!
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/4af7fbf5-1bf5-4c51-b82c-6d01e2c61634n%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/b7f0fddb-cf49-5d4d-55ea-592f7a7578d5%40igalia.com.
LGTM2
/Daniel
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfXap%3DKEvkQgr2ZZRtXPNFJvm1xJfRG%2Bdje7aH56obdU0g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw-YkwgDK0F_zMQN4R3sZECCd3vT5-y2-mvDCvM%2BGX_HhQ%40mail.gmail.com.
Hi all,We have an incoming issue for jQuery that seems pretty serious for them:
On Fri, Sep 2, 2022 at 11:40 AM Rune Lillesveen <fut...@chromium.org> wrote:Hi all,We have an incoming issue for jQuery that seems pretty serious for them:An update on the impact for jQuery:
Thanks for the update! Given that this is something that web developers have been using (as a polyfill, but still) for a loooong while, I'm somewhat skeptical that we can get away with the spec as currently written.As we can't have use-counters for things passed as jquery selectors, I wonder if an HTTPArchive and a GitHub search can reveal how widespread this is.But I suspect this is a "revert first and ask questions later"