Re: Encapsulation and defaulting to open vs closed (was Re: Shadow DOM Encapsulation)

On 2/6/14 9:03 PM, Tab Atkins Jr. wrote:
> With this, either "foo ^ bar" still works, or it doesn't.  If it
> doesn't work, then there's no way to opt it into working on your own.

I agree that the ^ combinator, as designed, cannot be built on a type 2 
model, though.  That's what Maciej was talking about when he said the 
design of ^ and ^^ was fundamentally incompatible with type 2: you can't 
build them on top of it, and if you allow them to work (at least in 
querySelector) then you can't have type 2 encapsulation...

> You have to add a brand-new explicit switch in the magic side of the
> API that makes the shadow tree "open", presumably for both JS and CSS.

That's basically the "I want type 1, not type 2" switch.

> You may recognize this as the *exact inverse* of what we've talked
> about for building Type 2 on top of Type 1 (having a switch that
> closes off a shadow root, so we can then selectively expose things to
> CSS via some other method).

So that would mean shutting off ^ and ^^ as well, yes?

> and need an additional primitive to really switch between them.

Is this something worth trying to design at this juncture?  It's not 
entirely clear easy that would be...

> (This can probably be chalked up to the fact that CSS is fairly hostile to
> polyfills, unlike almost all of JS.)

A great boon for CSS in some ways, for it allows much more interesting 
and parallelizable implementation strategies.  ;)

But yes, a bit of a PITA if you want to transparently extend it.

-Boris

Received on Friday, 7 February 2014 02:15:04 UTC