Re: [csswg-drafts] [css-scoping] Support for CSS namespaces

@tabatkins, in 
https://github.com/w3c/csswg-drafts/issues/137#issuecomment-222031438 
you said scoped styles would be “basically equivalent to just putting 
an ID on the container and using that in every rule”. That may not be 
really true as discussed further down in that thread, but if a simpler
 version of scoped styles would actually be equivalent to just that, 
than this would be a huge help with real use cases already and I don’t
 see why “just putting an ID on the container and using that in every 
rule” should be too much code complexity for browsers.

Let’s just define

```
@prepend foo {
    bar, baz {
        …
    }
    @prepend qux {
        dang {
            …
        }
    }
}
```

to be equivalent to

```
foo bar, foo baz {
    …
}
foo qux dang {
    …
}
```

To me, this seems to be just about syntactic sugar in CSS – but 
really, really sweet one that solves real problems. It doesn’t need 
more than that to prevent leaks in one direction, if `foo` is a unique
 ID. You don’t have to change anything about how CSS works in the 
background, you don’t need to touch specifity. Just treat the former 
code as if it were the latter.

For preventing leaks in both directions, you can require JavaScript 
and have all the complexity of shadow DOM for styles to work as 
desired, if that’s what many other developers want. I don’t bother.

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

Received on Tuesday, 12 July 2016 10:22:36 UTC