Re: Shadow DOM: Hat and Cat -- if that's your real name.

On Feb 4, 2014, at 12:44 PM, Robert O'Callahan <robert@ocallahan.org>
 wrote:

> An expedient approach would be to allow selectors to penetrate the shadow DOM by default and in a future spec revision add the ability for component authors to opt out of this, along with introducing other features to support custom styling.
> 
> The only argument I can think of against that is that the default is "unsafe" for component authors, who will unexpectedly find themselves in a deep hole later when they can't change anything their component without breaking pages. But that's not too bad; it's certainly no worse than the status quo, so at worst it's a missed opportunity.

Expedient seems the right term. I would assume that whatever default we pick on will be very hard to change once deployed. If we also think most authors will probably want to control which nodes can be selected then exposing all nodes by default seems the wrong starting point; it seems especially odd for a feature intended to bring better encapsulation. So while I think it's a fine model to start with while we're still experimenting, Google's posture suggests this is not just about yet another iteration behind their runtime flag. 

To over-simplify what I've heard for brevity:
1. The ^^ combinator is way more usable to component users then the ::pseudo syntax…
2. Attributes are a sucky way for component authors to declare which nodes are selectable…
3. …therefore, let us allow ^^ to select anything in the shadow tree.

I think Tab has made a persuasive argument about 1 and 2; I do not think we have established 3. I think we need a better way to address #2 for component authors *and* make ^^ only select those nodes the component author made public using this improved mechanism. And yes, they should be allowed to make their entire shadow tree public but that seems like a horrible default.

Received on Tuesday, 4 February 2014 21:49:34 UTC