question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template created elements do not upgrade as CE

See original GitHub issue

Description: If you use a template and inject offline AFrame components, these won’t ever be initialized in the live DOM world once appended.

var scene = '<a-scene><a-box color="red" position="0 2 -5" rotation="0 45 45" scale="2 2 2"></a-box></a-scene>';

var template = document.createElement('template'); // use 'div' in Chrome
template.innerHTML = scene;
document.body.appendChild((template.content || template).firstElementChild);

However, if you change template with div, as example, you’ll see that once appended everything is fine.

This makes AFrame component not suitable for any library that creates them via modern template.

Please note this is a Chrome bug only, and I’m not sure if I can fix it via document-register-element polyfill because apparently you are using your own fork.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
dmarcoscommented, May 16, 2019

Migration time has come. https://github.com/aframevr/aframe/pull/4167 moves A-Frame to Custom Elements V1. The old polyfill served as well a new one is also working as expected. Thanks for your help and patience.

2reactions
claytongulickcommented, Aug 28, 2018

Just so you have the feedback - I was bitten by this as well. Jumped in to a-frame, new to the webvr space, but very experienced with web components v1.

Created my project with my normal workflow, created custom elements wrapping a-frame scene, etc…

Nothing worked.

I love a-frame, you guys are doing an amazing job, but v1 is the future, looking forward to when I can use a-frame in the modern web components ecosystem.

Also happy to help with porting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template Change Does Not Update Elements - PI Square
I've implemented a custom data reference and used it in an AF Element Template so that it will be propagated through the AF...
Read more >
How do I set the Element Template to NONe via keyin
I have a series of DGN files that have Element Templates set 'AIS_Levels\Rev Cloud\Revision Clouds', so I want to reset them to NONE....
Read more >
The Content Template element - HTML - MDN Web Docs
The HTML element is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded but may...
Read more >
Development guide for GitLab CI/CD templates
Reviewers might not be able to create the data or configuration that the template requires, so an example project helps the reviewers ensure...
Read more >
Use of Template with HTML Custom Elements - Stack Overflow
</slot> to set up the contents of the custom element. You would then have to then include the template code in every HTML...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found