This is kind of a hack, but you can create a new registry by creating an
IFRAME and registering elements through its document, for example:
<iframe id="registry2" src="javascript:"></iframe>
var iframe = document.querySelector('#registry2');
iframe.contentDocument.registerElement(...);
etc.
There are other ways, but they all depend on this one weird trick of
creating a second, unrelated document and using its registry. Having the
iframe is convenient (although heavier) because you can also run scripts in
there, and the scripts get an isolated global object.
HTH,
Dominic
On Tue, Apr 7, 2015 at 8:41 PM, alessandro meyer <[email protected]
> wrote:
> Thank you for your answer.
>
> Is there a JS-based temporal solution (hack) to this?
>
> On Thursday, April 2, 2015 at 12:06:38 AM UTC+2, Daniel Freedman wrote:
>>
>> As far as I know, there is nothing in the spec as of yet to allow for
>> user defined registries. I believe this is planned for a later iteration of
>> the spec.
>> Spec bug about this topic: https://www.w3.org/Bugs/
>> Public/show_bug.cgi?id=24578
>>
>> On Wed, Apr 1, 2015 at 2:36 PM, alessandro meyer <[email protected]>
>> wrote:
>>
>>> Hello There
>>>
>>> I've been trying to found out whether it is possible to create nested
>>> registries either through polymer or native web components. But the W3C
>>> Spec is not really explicit enough for me about it.
>>>
>>> http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-
>>> registries
>>>
>>> Says:
>>> *When creating a template contents owner document
>>> <https://html.spec.whatwg.org/multipage/scripting.html#appropriate-template-contents-owner-document>,
>>> use a new empty registry
>>> <http://w3c.github.io/webcomponents/spec/custom/#dfn-registry>.*
>>>
>>> How would I do that? My goal is to have scoped imports so elements never
>>> clash in the global scope. If there are other approaches to it I'm happy to
>>> give them a try.
>>>
>>> Thanks!
>>> Alessandro
>>>
>>> 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/53c86322-eb32-4f23-84a3-0d2727d911bd%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/polymer-dev/53c86322-eb32-4f23-84a3-0d2727d911bd%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/91fb65f1-8cff-4c17-b429-a2a8efdcfad0%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/91fb65f1-8cff-4c17-b429-a2a8efdcfad0%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/CAHnmYQ9%3DV%2BpBSaoOsxKW%3DJzoAruRondUoiFCifERQfD76%2BeKkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.