> On Mar 12, 2015, at 5:46 PM, Travis Leithead <travis.leith...@microsoft.com> 
> wrote:
>  
>    Has the idea of loading/parsing a Shadow DOM directly from a URL been 
> discussed already? (e.g., a sort-of “micro-import” or an import that parses 
> its document directly into the ShadowRoot container?) I’m curious to know if 
> there’s some obvious flaw that I’m missing.
>  
> element.createShadowRoot(“path to my component”);
>  
>   This is an idea around building components from the “inside out”, and using 
> the URL as the basis for script-level access control to the Shadow contents.

Hi Travis,

I think this idea resonates well with the cross-origin use case / API change 
proposal we made two years ago [1].  In that proposal, we went a step further 
and tied custom elements with URLs so that those shadow DOM can be 
automatically instantiated by simply using those custom elements.

e.g. if “like-button” element was defined in 
https://webkit.org/components.html, then we can use that component by simply 
"importing" the definition:

<link rel=import href="https://webkit.org/components.html"; 
defines="like-button”>

and using it in the same document (that imported components.html):

<like-button data-url="https://build.webkit.org/";>Like 
build.webkit.org</like-button>

We thought this model was more developer friendly than having each user of the 
component manually create shadow root.  We also didn’t want to make component 
authors deal with situations like a shadow root being attached to an iframe, 
input, etc..

[1] https://lists.w3.org/Archives/Public/public-webapps/2013OctDec/0418.html

- R. Niwa

Reply via email to