w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.38k stars 641 forks source link

[css-scoping] Always serialise the implicit `:scope` ? #9621

Open mdubet opened 8 months ago

mdubet commented 8 months ago

For the css-nesting spec, we resolved to always serialise the implicit &:

When serializing a relative selector in a nested style rule, the selector must be absolutized, with the implied nesting selector inserted.

https://drafts.csswg.org/css-nesting/#cssom

Should we do the same for the implicit :scope in scoped style rule ?

They accept a relative-selector-list as their prelude (rather than just a selector-list). Such relative selectors are relative to :scope.

css-meeting-bot commented 7 months ago

The CSS Working Group just discussed [css-scoping] Always serialise the implicit `:scope` ?, and agreed to the following:

The full IRC log of that discussion <frances__> rossen: always serialize implicit scope?
<bramus> s/accepts custom/accepts auto.
<TabAtkins> q+
<frances__> matthieu d: in css copying spec all rules in the spec have a : scot selector, nesting serialize implicit selector, value context related to selector
<Rossen_> ack TabAtkins
<emilio> q+
<Rossen_> ack emilio
<frances__> tabatkins: more transportable to other spots for javascript copying and pasting
<miriam> q+
<frances__> emilio: consistent for @ scope or nested inside, still seems fine
<Rossen_> ack miriam
<frances__> miriam: question, what implications does this have for the behavior or just internal?
<frances__> matthieu d: no implication, only for serialization, one value for specificity, already counted
<frances__> miriam: some questions from roman about nesting and scope and how the implicit scope works in nested context
<frances__> matthieu d: serializing when there is an implicit scope
<frances__> rossen: any other questions/concerns?
<frances__> rossen: any objections?
<frances__> PROPOSAL: serialize implicit scope pseudoclass in rule selectors
<frances__> RESOLUTION: serialize implicit scope pseudoclass in rule selectors
mirisuzanne commented 1 month ago

Agenda+ to revert this, since we can't serialize something that would change the specificity.

css-meeting-bot commented 2 weeks ago

The CSS Working Group just discussed [css-scoping] Always serialise the implicit `:scope` ?, and agreed to the following:

The full IRC log of that discussion <khush> andruud: if a :scope is implicitly added it's not serialized back out. because there is a diff between implicit and explicit :scope in terms of specificity
<khush> so they are not equivalent.
<khush> astearns: doesn't change anything about serialization of explicit :scope
<khush> astearns: proposal is to reverse the previous resolution and not serialize implicit :scope
<khush> matthieud: we agreed to do that for nested rules not inside ... the idea to always serialize nested rule is to take the selector from a nested rule and apply elsewhere.
<khush> matthieud: you can't move everything around and expect it to work automatically
<khush> astearns: any other comments?
<khush> astearns: objections to not serializing implicit scope
<khush> RESOLVED: reverse the previous resolution and not serialize implicit :scope pseudos
<matthieud> we can' t move a relative selector like "> div" from a context where it's valid to a context where it's not valid (top level rule)
<khush> github-bot take up https://github.com/w3c/csswg-drafts/issues/10389