On Sun, Oct 6, 2013 at 9:21 AM, Anne van Kesteren <ann...@annevk.nl> wrote:
> On Sun, Oct 6, 2013 at 5:25 PM, Dimitri Glazkov <dglaz...@chromium.org> > wrote: > > On Sun, Oct 6, 2013 at 6:26 AM, Angelina Fabbro < > angelinafab...@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<