Re: [csswg-drafts] [css-cascade-6] add a :stylesheet selector to match the current stylesheet (#7349)

The CSS Working Group just discussed `:stylesheet`, and agreed to the following:

* `RESOLVED: @scope without selector scopes to the parent of the owner node, or the containing tree if there's no owner node`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> topic: :stylesheet<br>
&lt;emilio> github: https://github.com/w3c/csswg-drafts/issues/7349<br>
&lt;emilio> miriam: this is about stylesheets in the dom and scoping<br>
&lt;emilio> ... idea is to use `:stylesheet` / `:stylesheet-parent` to select stuff inside this scope<br>
&lt;emilio> ... that would allow you to scope the stylesheet<br>
&lt;emilio> ... most usecases prefer the stylesheet parent<br>
&lt;emilio> ... I don't have strong use cases for any<br>
&lt;fremy> huge +1<br>
&lt;emilio> fantasai: is there any use case other than implementing &lt;style scoped>?<br>
&lt;emilio> miriam: no<br>
&lt;emilio> fantasai: then how about doing that?<br>
&lt;emilio> miriam: problem is backwards compat<br>
&lt;heycam> q+<br>
&lt;emilio> ... if scope is not recognized it's applied unscoped<br>
&lt;emilio> fantasai: can we use empty @scope rule for this?<br>
&lt;emilio> miriam: I like it<br>
&lt;emilio> ... we'd be setting aside being able to select the stylesheet's sibling<br>
&lt;Rossen_> ack heycam<br>
&lt;emilio> heycam: 2 things, does @scope nest? What would it mean if you would use @scope without a selector, would it be sensible?<br>
&lt;heycam> emilio: it would have sensible behavior<br>
&lt;heycam> ... the rule wouldn't apply, you would apply both filters<br>
&lt;emilio> heycam: second point is that there are stylesheets without nodes (constructable stylesheets)<br>
&lt;emilio> ... so we'd need to decide what it does<br>
&lt;heycam> emilio: it could also do nothing. just not match.<br>
&lt;heycam> fremy: this is in @scope<br>
&lt;heycam> emilio: so it would always match<br>
&lt;heycam> emilio: is &lt;style scoped> really not possible?<br>
&lt;heycam> ... layers have the same issue<br>
&lt;heycam> ... you use layers<br>
&lt;heycam> miriam: if we get the media attribute extended to support supports(), then the media attribute can fail, and stop the style sheet from being applied<br>
&lt;heycam> ... you could use that along with the new attribute<br>
&lt;heycam> ... that's the proposal for layers and scope attributes<br>
&lt;heycam> emilio: I don't think any engine keeps around the DOM node deep enough, it could be done<br>
&lt;heycam> miriam: it has a bit less flexibility than what Tab was suggesting, where you could still apply a lower boundary<br>
&lt;heycam> ... while letting the upper boundary be applied by the position of the style sheet<br>
&lt;heycam> ... since lower boundaries is a bit part of what scoping provides, that might be a reason to go with the change to the @scope rule<br>
&lt;heycam> emilio: if I had to choose between :stylesheet and @scope, I'd go for @scope<br>
&lt;heycam> chrishtr: for the bottom or the top of the scope?<br>
&lt;emilio> miriam: the top, if you use no selector it'd use the parent of the &lt;style> / &lt;style> element as the scope root<br>
&lt;emilio> fantasai: if your &lt;link> is in your &lt;head> it doesn't accomplish very much<br>
&lt;emilio> chrishtr: what about constructable stylesheets?<br>
&lt;fantasai> s/it does/the stylesheet does/<br>
&lt;emilio> heycam: you need to define it but I think it logically shouldn't scope to anything<br>
&lt;emilio> chrishtr: could you add a `scope` property to the stylesheet to be able to scope a constructable stylesheet?<br>
&lt;emilio> heycam: yeah that should be doable<br>
&lt;dbaron> (leaving meeting now, probably back around 5pm)<br>
&lt;emilio> miriam: do we want links in &lt;head> to also style the whole doc?<br>
&lt;emilio> fantasai: I don't think you want to do that, it'd just end up not styling anything<br>
&lt;fantasai> s/anything/much of anything/<br>
&lt;emilio> RESOLVED: @scope without selector scopes to the parent of the owner node, or the containing tree if there's no owner node<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7349#issuecomment-1248666611 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 15 September 2022 21:47:36 UTC