On Thu, Apr 10, 2014 at 10:21 AM, Jan Miksovsky <[email protected]> wrote:

> It looks like dynamic HTML imports are now supported in both Canary
> (natively) and the polyfill.
>
> From experimentation, it appears that <link> tags programmatically added
> to the page's light DOM load as expected. However, links added to a shadow
> subtree are not handled and have no effect.
>
> Can someone please confirm if that analysis is correct?
>
> I tried looking through the spec, which talks about links being associated
> with the document, but it doesn't specifically say that links in shadow DOM
> are ignored, so I wanted to check. I ask because I have a component that
> wants to dynamically load another, and it appears to be able to do so in
> its light DOM but not its shadow. This to some extent cracks the opacity of
> the component's internal workings, so I'd been hoping to keep the dynamic
> links completely within the component's shadow.
>

This is an interesting question. I filed https://crbug.com/362255 for
tracking this.

Would you mind to explain how you intend to use <link rel=import> in Shadow
DOM? We could possibly make this work, but I'm not sure if this should
work. I don't see how it can be useful. In the context of dynamic loading,
we can just put newly created <link> into document.head, cannot we?

Let's compare it to <link rel=stylesheet>. It works in Shadow DOM, and the
style is applied to the scope (shadow tree). For imports though, it make
less sense to bound it to the scope. Although we could imagine a scoped
import whose styleheets are loaded into the Shadow Tree, its benefit isn't
clear for me and it will introduce certain complexity to the design.

If it isn't scoped to Shadow DOM, it doesn't make sense to have it in
Shadow DOM. Other things like <meta>, non-style <link>, <input>, etc. are
hidden from global document scope when it is in Shadow DOM. The current
behavior could be explained in this line.

What do you think?

--
morrita






>
> On Friday, February 7, 2014 8:48:35 AM UTC-8, Eric Bidelman wrote:
>
>> Dynamic imports are now supported, but we haven't done a release yet that
>> includes it.
>>
>> +steve and +scott have a few demos they might be able to share. Both show
>> dynamic/async imports.
>>
>>
>> On Fri, Feb 7, 2014 at 4:29 AM, Matt Bourne <[email protected]> wrote:
>>
>>> Hi Eric
>>>
>>> It seems there is a similar question on stack exchange
>>>
>>>  http://stackoverflow.com/questions/21607663/dynamically-load-web-
>>> components-html-imports/21627702#21627702
>>>
>>> I wonder if one of the devs could given an updated answer.
>>>
>>> I understand that we can instantiate our custom elements just like
>>> normal elements at any time. The question is more around loading the html
>>> import for the element with all its css and js includes for example using
>>> ajax then when it's loaded add the polymer element.
>>>
>>> Obviously in a heavy single page web app design I only want to load the
>>> slideshow element (for example) if it's actually needed. In my use case I
>>> want users to be able to choose between many quite rich elements (flipbook,
>>> map, gallery, slideshow) I only want to load those elements if they are
>>> used.
>>>
>>> Matt
>>>
>>> Follow Polymer on Google+: plus.google.com/107187849809354688692
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Polymer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/polymer-dev/edcd77c6-013a-4e98-bb36-1ea19ba3affa%
>>> 40googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  Follow Polymer on Google+: plus.google.com/107187849809354688692
> ---
> You received this message because you are subscribed to the Google Groups
> "Polymer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/ce563e1c-e264-4df0-8515-28c7ab122b48%40googlegroups.com<https://groups.google.com/d/msgid/polymer-dev/ce563e1c-e264-4df0-8515-28c7ab122b48%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CALzNm5oQ1LogK94pMAUpy_oefH71zt5GTMK%2BXZcsT6Gz4hWoZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to