- From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
- Date: Wed, 01 Jun 2022 16:26:41 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `[selectors-4] Consider disallowing :host, :host(), :host-context() inside :has()`, and agreed to the following: * `RESOLVED: No change` <details><summary>The full IRC log of that discussion</summary> <fantasai> topic: [selectors-4] Consider disallowing :host, :host(), :host-context() inside :has()<br> <fantasai> github: https://github.com/w3c/csswg-drafts/issues/7212<br> <fantasai> futhark: Given resolution wrt :scope, at least from Chrome side, we agree that :host-context will neve match inside :has() because it needs to have sibling/parent ... shadow tree<br> <emilio> q+<br> <fantasai> futhark: not a perf problem, but it will never match<br> <fantasai> futhark: proposed resolution from our side is no change<br> <fantasai> TabAtkins: :host will never match as final selector, but the example here ...<br> <TabAtkins> .b:has(:host .a .c)<br> <fantasai> TabAtkins: slightly simplified version of a selector in the issue<br> <fantasai> TabAtkins: this would still match<br> <fantasai> TabAtkins: however it's exactly equivalent to just moving the :host outside<br> <fantasai> TabAtkins: if we were to ban it, wouldn't hurt anything, but is matchable in this instance<br> <fantasai> bkardell_: Because doesn't begin with a relative combinator<br> <fantasai> TabAtkins: so evaluates globally against the context<br> <emilio> q-<br> <fantasai> bkardell_: This is where the whole weird context comes from<br> <fantasai> bkardell_: I think a lot of ppl would not expect that to match<br> <fantasai> futhark: From impl side of things, it's not an important issue<br> <fantasai> futhark: removing special meaning of :scope means it's not a perf issue<br> <fantasai> bkardell_: so you would ... walk all the way up the tree?<br> <fantasai> bkardell_: Seems weird to me that this should match<br> <fantasai> bkardell_: basically nobody would expect it<br> <fantasai> TabAtkins: it's the same as putting :root in there<br> <fantasai> TabAtkins: why expect not to match?<br> <fantasai> bkardell_: Even in jquery etc., :has() you start matching at the boundary, you don't walk all the way up the tree<br> <miriam> q+<br> <fantasai> TabAtkins: Am I misremembering this?<br> <fantasai> :has(:is(:host .a)<br> <fantasai> )<br> <fantasai> maybe you mean something like that?<br> <miriam> q-<br> <TabAtkins> fantasai: The host element doesn't necessarily ahve to be inside...<br> <TabAtkins> fantasai: the host doen't have to be in the :has()<br> <TabAtkins> fantasai: When you have :is() tho, that doesn't necessarily get scoped.<br> <TabAtkins> fantasai: So if you nest it like this, this could match.<br> <fantasai> :has(:is(:root .a)) would match, for example<br> <fantasai> TabAtkins: That's right, would do it<br> <fantasai> fantasai: My inclination is to make this invalid, would be easier for everyone to understand and get it right<br> <fantasai> astearns: You would get the same effect by moving :host outside of :has()<br> <fantasai> TabAtkins: yes<br> <emilio> q?<br> <bkardell_> q+<br> <emilio> the bot is dead?<br> <TabAtkins> A:has(:is(:host B)) rewrites to :is(:host A, A:host):has(B)<br> <fantasai> bkardell_: Previous example was one that Oriol pointed out. did we agree to the opposite, that you can't use :is()? or did I misunderstand?<br> <fantasai> TabAtkins: all other relational selectors are fine<br> <fantasai> bkardell_: what was proposal?<br> <fantasai> TabAtkins: make :host illegal inside of :has() context<br> <fantasai> emilio: If no reason to disallow performance-wise, probably more work to disallow. But don't mind either way<br> <fantasai> futhark: I don't have strong feelings either way<br> <fantasai> astearns: given confusion we just put ourselves through, I have a slight preference for disalowing<br> <fantasai> astearns: because it's an unreadable way of expressing this<br> <fantasai> bkardell_: I agree<br> <fantasai> TabAtkins: :host does have theoretical use in here, because if you want to select a top-level element in your shadow tree need to use ':host > element'<br> <fantasai> TabAtkins: it's no more confusing than :root in this context<br> <fantasai> TabAtkins: so that part doesn't bother me<br> <fantasai> emilio: Why would you want to use direct child combinator? You can't have anything that's direct child of host in here<br> <fantasai> bkardell_: ...<br> <fantasai> emilio: so :host :has(stuff)<br> <fantasai> emilio: You would need to be :host(:has())<br> <TabAtkins> .foo:has(:is(:host > .top-level .bar))<br> <fantasai> TabAtkins: This is a meaningful selector<br> <fantasai> TabAtkins: it's a .foo that has a non-top-level-.bar inside it<br> <fantasai> emilio: yeah, ok, fine<br> <fantasai> emilio: Assuming there's no reason to ban it perf-wise, then seems fine to keep it<br> <fantasai> astearns: I'm hearing a lot of "eh"<br> <emilio> +1<br> <fantasai> TabAtkins: I suggest we leave as-is, unless on further investigation it has a perf implication<br> <fantasai> futhark: I agree<br> <fantasai> RESOLVED: No change<br> <fantasai> s/change/change; :host etc. continues to be allowed inside :has()/<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7212#issuecomment-1143834345 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 1 June 2022 16:26:43 UTC