Re: Shadow tree style isolation primitive

On Jan 13, 2015, at 4:15 AM, chaals@yandex-team.ru wrote:

> 13.01.2015, 00:57, "Ryosuke Niwa" <rniwa@apple.com>:
>>>  On Jan 12, 2015, at 4:13 AM, chaals@yandex-team.ru wrote:
>>> 
>>>  09.01.2015, 16:42, "Anne van Kesteren" <annevk@annevk.nl>:
>>>>  I'm wondering if it's feasible to provide developers with the
>>>>  primitive that the combination of Shadow DOM and CSS Scoping provides.
>>>>  Namely a way to isolate a subtree from selector matching (of document
>>>>  stylesheets, not necessarily user and user agent stylesheets) and
>>>>  requiring a special selector, such as >>>, to pierce through the
>>>>  boundary.
>>>  Sounds like a reasonable, and perhaps feasible thing to do, but the obvious question is "why?"
>>> 
>>>  The use cases I can think of are to provide the sort of thing we do with BEM today. Is the effort worth it, or are there other things I didn't think of (quite likely, given I spent multiple seconds on the question)?
>> 
>> The benefit of this approach is that all the styling information will be in one place.  CSS cascading rules is already complicated, and having to consult the markup to know where the selector boundary is will be yet another cognitive stress.
> 
> Sorry, I'm dense this morning for sure. Why would all the styling information be in one place? I'm still thinking from the model of BEM, where the benefit is that for a particular block you can collect everything (styling, scripts, whatever magic you want - or just a couple of plain tags and 4 words) in one place, and the different pieces get stitched together without having to worry about how they will impact each other because ordinarily they won't.

To separate presentational information (CSS) from the semantics (HTML).  Defining both style isolation boundaries and the associated CSS rules in an external CSS file will allow authors to change both of them without having to modify every HTML documents that includes the CSS file.  Of course, this is a non-starter for Web apps that require a lot of scripting, but style isolation is a very useful feature for a lot of static pages as well.

- R. Niwa

Received on Tuesday, 13 January 2015 19:07:54 UTC