Re: [webcomponents]: Making Shadow DOM Subtrees Traversable

On Thu, Nov 1, 2012 at 9:02 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 11/1/12 7:41 AM, Tab Atkins Jr. wrote:
>>
>> There was no good *reason* to be private by default
>
>
> Yes, there was.  It makes it much simpler to author non-buggy components.
> Most component authors don't really contemplate how their code will behave
> if someone violates the invariants they're depending on in their shadow
> DOMs.  We've run into this again and again with XBL.
>
> So pretty much any component that has a shadow DOM people can mess with but
> doesn't explicitly consider that it can happen is likely to be very broken.
> Depending on what exactly it does, the brokenness can be more or less
> benign, ranging from "doesn't render right" to "leaks private user data to
> the world".
>
>
>> As a general rule, we should favor being public over
>> being private unless there's a good privacy or security reason to be
>> private.
>
>
> As a general rule we should be making it as easy as possible to write
> non-buggy code, while still allowing flexibility.  In my opinion.

This has been my concern as well.

The story that made me sway is the elementFromPoint story. It goes
like this: we had an engineer come by and ask to add elementFromPoint
to ShadowRoot API.

... this is a short story with a happy ending
(https://www.w3.org/Bugs/Public/show_bug.cgi?id=18912), since
ShadowRoot hasn't shipped anywhere yet. However, imagine all browsers
ship Shadow DOM (oh glorious time), and there's a new cool DOM thing
that we haven't thought of yet. Without ability to get into shadow
trees and polyfill, we'll quickly see people throw nasty hacks at the
problem, like they always do (see one that Dominic suggested here:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15409#c5). And that
seems like a bad smell.

I am both excited and terrified.

Excited, because discovering Angelina Farro's talk
(http://www.youtube.com/watch?v=JNjnv-Gcpnw) makes me realize that
this Web Components thing is starting to catch on.

Terrified, because we gotta get this right. The Web is traditionally
very monkey-patchey and pliable and our strides to make the boundaries
hard will just breed perversion.

Anyhow. Elliott has made several passionate arguments for travsersable
shadow trees in person. Maybe he'll have a chance to chime in here.


:DG<

Received on Tuesday, 6 November 2012 23:45:17 UTC