You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After moving from 0.9 to 1.0, I noticed that all my components that rely on appending content to the light DOM have stopped working. I did not see any breaking changes related to this. Was I doing something wrong from the start or is this a bug?
Below is an example of what I am talking about. The below code does not work for me.
<dom-module id="respond-content">
<template></template>
</dom-module>
<script>
Polymer({
is: "respond-content",
// element attributes
properties: {
url: { type: String },
contentid: { type: String },
cssclass: { type: String }
},
// attached
attached: function() {
var toLight = document.createElement('div');
toLight.innerHTML = '<h1>This worked in Polymer 0.9</h1>';
Polymer.dom(this).appendChild(toLight);
}
});
</script>
The text was updated successfully, but these errors were encountered:
Here you're creating a local DOM tree with nothing in it (by including the empty <template>). If you include a local DOM tree, it gets rendered in place of the children.
To render light DOM children (or "project" them into the local DOM), add an insertion point in local DOM by adding a <content> tag:
<template>
<content></content>
</template>
I believe you were seeing the children render before because of a bug in 0.9.
After moving from 0.9 to 1.0, I noticed that all my components that rely on appending content to the light DOM have stopped working. I did not see any breaking changes related to this. Was I doing something wrong from the start or is this a bug?
Below is an example of what I am talking about. The below code does not work for me.
The text was updated successfully, but these errors were encountered: