Re: [csswg-drafts] [css-scoping] scoped attribute on style element removed from HTML

Thanks for the information, though it is sad to hear.

Shadow DOM may be more powerful, but requires JavaScript, which makes 
it less reliable or unusable in some contexts. Shadow DOM encapsulates
 code in two directions, i.e. styles in the shadow tree don’t affect 
outside markup and outside styles don’t affect shadow markup.

`@scope` would be different: It is about nesting. It would prevent 
inside styles from affecting outside markup, but allow outside styles 
to affect scoped markup. I understand that there are ways to pierce 
through shadow DOM’s shadow boundary from outside, but that has to be 
made explicit while it would automatically work for `@scope`.

I understand that `@scope {…}` would basically be equivalent to 
putting an ID on a container and using that in every rule, but 
sometimes we only have limited control over part of the rules and it 
would be very helpful to be able to encapsulate them against 
influencing anything outside a container easily. In my case, the 
alternative is to write/use a whole server-side CSS parser in order to
 be able to inject IDs at all the right and no wrong places 
automatically.

Compared to using a container ID in every rule, `@scope` would reduce 
redundancy (→ less typing, less bandwidth, less work/errors when 
changing code) which all users could benefit from, even if they have 
total control over their styles.

Nesting is a headline feature of CSS pre-processors like Less [1] and 
Sass [2] and CSS-Crush [3]. I think that shows that nesting 
capabilities are a desired and useful feature which `@scope` would 
have provided.

[1] 
http://lesscss.org/features/#features-overview-feature-nested-rules
[2] http://sass-lang.com/guide#topic-3
[3] http://the-echoplex.net/csscrush/#core--nesting

-- 
GitHub Notification of comment by prlbr
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/137#issuecomment-222114266 
using your GitHub account

Received on Friday, 27 May 2016 10:31:13 UTC