Re: [webcomponents] HTML Imports

> We should ask Polymer people: they wrote a ton of code with Imports now
and I bet they have opinions.

The Polymer team has successfully adopted/evolved the modality Dimitri
describes. Imported documents work roughly as #includes, and
`currentScript.ownerDocument` is interrogated if one needs to locate their
containing import from (non custom-element) script.

> I sincerely hope that when we get back to declarative form, we will be
able to write declarative custom element syntax as a custom element itself.
:)

Of course, this is exactly <polymer-element>, and because it is itself an
element it has easy access to the import tree.



On Sun, Oct 6, 2013 at 9:38 AM, Dimitri Glazkov <dglazkov@chromium.org>wrote:

>
>
>
> On Sun, Oct 6, 2013 at 9:21 AM, Anne van Kesteren <annevk@annevk.nl>wrote:
>
>> On Sun, Oct 6, 2013 at 5:25 PM, Dimitri Glazkov <dglazkov@chromium.org>
>> wrote:
>> > On Sun, Oct 6, 2013 at 6:26 AM, Angelina Fabbro <
>> angelinafabbro@gmail.com>
>> > wrote:
>> >> And, if the script is executed against the global/window object of the
>> >> main document, can and should you be able to access the imported
>> document?
>> >
>> > You can and you should. HTML Imports are effectively #include for the
>> Web.
>>
>> So you have <link href=blah.html> in meh.html and blah.html is:
>>
>> <div id=test></div>
>> <script> /* how do I get to #test? */ </script>
>>
>
> document.currentScript.ownerDocument.querySelector("#test") :)
>
>
>> Having thought a bit more about how declarative custom elements would
>> work that might not actually be much of a problem (assuming we go with
>> Allen's model), but it seems somewhat worrying that the document the
>> <script> elements are inserted in is not actually the one the scripts
>> operate on.
>>
>
> I think the greatest impact here will be on developers. They have to start
> thinking in terms of multiple documents. We should ask Polymer people: they
> wrote a ton of code with Imports now and I bet they have opinions.
>
>
>>
>> (The way I expect we'll do declarative custom elements is <element
>> constructor=X> combined with <script> class X extends HTMLElement {
>> ... } </script>.)
>>
>
> I sincerely hope that when we get back to declarative form, we will be
> able to write declarative custom element syntax as a custom element itself.
> :)
>
> :DG<
>

Received on Sunday, 6 October 2013 17:16:34 UTC