W3C home > Mailing lists > Public > www-style@w3.org > February 2014

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 6 Feb 2014 18:03:37 -0800
Message-ID: <CAAWBYDCA820NkEu-XTPaD7kR9rThhnT10GZFpRW6Gw4Ly7gHJA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style list <www-style@w3.org>
On Thu, Feb 6, 2014 at 5:45 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 2/6/14 8:28 PM, Tab Atkins Jr. wrote:
>> Of course it's possible to build Type 2 on top of Type 1 - just delete
>> or override the .shadowRoot accessor from the element.
>
> That's not true given querySelector("foo ^^ bar"), as far as I can tell,
> which was what Maciej was saying about the proposed default behavior of ^^.

It's not true if Maciej's Type 2 is used, either, at least as it's
been proposed before.

Previous proposals for this kind of thing were that shadow DOM trees
were constructed explicitly, but were just independent objects; the
host object knows what its shadows are, but doesn't expose them in any
way.  If script wants to expose them, it puts them on some expando of
its choice, with convention hopefully dictating common patterns.

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.
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.

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).  There's no way to do a full-fidelity
reproduction of either type on top of the other; you can fake it to
some extent, but ultimately the two models are slightly incompatible,
and need an additional primitive to really switch between them.  (This
can probably be chalked up to the fact that CSS is fairly hostile to
polyfills, unlike almost all of JS.)

~TJ
Received on Friday, 7 February 2014 02:04:24 UTC

This archive was generated by hypermail 2.3.1 : Friday, 7 February 2014 02:04:24 UTC