Re: Shadow tree style isolation primitive

If the goal is to isolate a style sheet or several per a DOM sub tree then why not just use scoped style element that has imports that apply the stylesheet(s) only to the sub tree in scope? Obviously, you are talking about preventing stylesheets applied at a higher level from leaking in. So maybe then in the scoped style element there can be some @ declaration like @isolate that would tell the browser not to apply any styles defined at a higher level. Not sure how browsers would implement that but it seems that since we (developers) already have a way to define scoped style that it ought to be possible to isolate the elements that we're applying the scoped style to from styles defined by the user at a higher level while still applying user agent styles. Just a thought... 

Sent from my iPhone

> On Jan 12, 2015, at 8:47 AM, Brian Kardell <bkardell@gmail.com> wrote:
> 
> 
> 
>> On Mon, Jan 12, 2015 at 7:04 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
>> On Fri, Jan 9, 2015 at 10:11 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> > tl;dr: Cramming a subtree into a TreeScope container and then hanging
>> > that off the DOM would do the job "for free" (because it bakes all
>> > that functionality in).
>> 
>> Sure, or we could expose a property that when set isolates a tree.
>> Both a lot simpler than requiring ShadowRoot. However, it seems to me
>> that ideally you can control all of this through CSS. The ability to
>> isolate parts of a tree and have them managed by some other stylesheet
>> or selector mechanism.
> 
> Controlling it through CSS definitely seems to be very high-level.  To me at least it feels like it requires a lot more answering of "how" since it deals with identifying elements by way of rules/selection in order to differentially identify other elements by way of rules/selection.  At the end of the day you have to identify particular elements as different somehow and explain how that would work.  It seems better to start there at a reasonably low level and just keep in mind that it might be a future aim to move control of this sort of thing fully to CSS.  Since CSS matching kind of conceptually happens on 'not exactly the DOM tree' (pseudo elements, for example) it seems kind of similar to me and it might be worth figuring that out before attempting another high-level feature which could make answering 'what's the path up' all that much harder.
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
> 
>  
>> --
>> https://annevankesteren.nl/
> 
> 
> 
> -- 
> Brian Kardell :: @briankardell :: hitchjs.com

Received on Monday, 12 January 2015 17:42:14 UTC