W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2015

Re: [Shadow] URL-based shadows?

From: Ryosuke Niwa <rniwa@apple.com>
Date: Wed, 18 Mar 2015 14:25:59 -0700
Cc: "Dimitri Glazkov (dglazkov@google.com)" <dglazkov@google.com>, WebApps WG <public-webapps@w3.org>, "Anne van Kesteren (annevk@annevk.nl)" <annevk@annevk.nl>, Arron Eicholz <arronei@microsoft.com>
Message-id: <A1E91FCD-CB8A-424A-B332-9C3D2BD6ACA5@apple.com>
To: Travis Leithead <travis.leithead@microsoft.com>

> On Mar 12, 2015, at 5:46 PM, Travis Leithead <travis.leithead@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
Received on Wednesday, 18 March 2015 21:26:30 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:26 UTC