Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template stamping doesn't work in custom element light DOM #2010

Closed
nomego opened this issue Jul 2, 2015 · 3 comments
Closed

Template stamping doesn't work in custom element light DOM #2010

nomego opened this issue Jul 2, 2015 · 3 comments
Assignees
Labels

Comments

@nomego
Copy link

nomego commented Jul 2, 2015

Considering the following code:

var appendTo = this.$.myCustomElement,
  t = document.createElement('template', 'dom-bind'),
  span = document.createElement('span');
span.innerHTML = '{{hello}}';
t.content.appendChild(span);
t.hello = 'hey';

Appending this to the light DOM won't work:

Polymer.dom(appendTo).appendChild(t);

This will only render the template tag with the content within and data-binding placeholders emptied.
The dom-change event will actually fire and informs me that the attached() callback stuff of the dom-bind element actually have been run.
But stamping fails and moving the content outside the template never happens.
Tries with dom-template and manual stamp() also failed.

It actually needs to be in the local DOM:

Polymer.dom(appendTo.root).appendChild(t);

Is this a bug or by design?
Could not find any documentation on this.

@sorvell
Copy link
Contributor

sorvell commented Jul 8, 2015

I can confirm this issue. Here's a simple test and a workaround:

http://jsbin.com/vagugufowi/1/edit (see the //workaround comment)

We'll try to get this fixed by the next release.

@sorvell
Copy link
Contributor

sorvell commented Jul 8, 2015

Related to #1818.

@nomego
Copy link
Author

nomego commented Jul 8, 2015

Thank you, and thanks for the workaround.
It would be semantically more accurate to append to the light DOM with consideration of the content.
Also, it's good if this process works the same way for native and custom elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants