Re: [webcomponents]: Changing API from constructable ShadowRoot to factory-like

Sorry for the late response.

Adding more "create*" methods feels like a bug. I understand that there are
a couple of concerns/arguments here:

   - Current implementations that aren't self-hosting are going to have
   trouble with the idea of unattached ("floating") ShadowRoot instances
   - As a result, the mental model implementers seem to have is that "new
   ShadowRoot(element)" has side-effects *on the element*, and that pretty
   clearly feels wrong. A future when re-attaching a ShadowRoot to a different
   element solves this (root.attach(element)?), but it's not planned for now.
   - "new" may lead to errors when a ShadowRoot instance is allocated out
   of one window and an element to attach to is from another. The general DOM
   solution of "allocate out of the element's ownerDocument window" feels
   right here, but isn't elegant in some corner cases.

So while I still favor something like "new ShadowRoot().attach(element)" or
"new ShadowRoot(element)", I think I can live with the create*() version
for now.

I would like for us to support one of the forward-looking versions,
however, if only in a known-limited form.


On Tue, Nov 20, 2012 at 12:08 AM, Dimitri Glazkov <dglazkov@google.com>wrote:

> I made the change to the editor's draft:
> http://dvcs.w3.org/hg/webcomponents/rev/e0dfe2ac8104
>
> You can read the shiny new parts of the spec here:
>
> http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-element
>
> Please let me know if I goofed up something, preferably by filing bugs :)
>
> :DG<
>
>

Received on Monday, 3 December 2012 18:34:11 UTC