Hesh
Hesh

Reputation: 433

Dynamically inserted Element within Polymer Element not Visible

Within the ready() method of a custom polymer element, I am creating a new element and dynamically inserting it. Even though it is seen to be part of the Shadow DOM, it is not visible on the page.

What could be the explanation and how to solve this?

DivElement de = new DivElement();
de.text = 'new div';
de.setAttribute('id' ,'myholder');
append(de);

Upvotes: 2

Views: 113

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658037

This way you add it as child instead of as part of the shadow DOM. Use shadowRoot.append... instead. If you don't have a <content></content> element inside your elements template, children are not displayed.

Upvotes: 3

Related Questions