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
I'm trying to use dom-repeat to create a list of paper buttons, which have a custom attribute that I set. The html template for the custom element is a bit complicated but here is an example that illustrates the core issue:
<my-element> has an property experiments which gets updated frequently with new data. experiments is used to generate a list of <paper-button> with a custom attribute label that's set to item.name.
Let's call the first paper button, button. I would expect button.getAttribute(label) === joe and button.label === undefined. That's not the case. Some magic sets button.label to joe. That's fine. It could be useful magic.
Now let's set experiments = [{name: "cat", job: "maker"}]. I would expect button.getAttribute(label) === cat, and indeed that's correct. But button.label === joe.
Why is this happening?
It feels like a bug because I'd expect reused elements not have zero state that indicates they were used for anything else before.
Yes, this looks like a bug with the data configuration process Polymer uses to efficiently flow binding data to other Polymer elements at initial construction of the tree. It incorrectly passes attribute bindings as property data. This should be trivial to fix, such that the label property is always undefined in your paper-button example: http://jsbin.com/gonola/edit?html,console -- I assume this is what you would expect, yes?
I'm trying to use dom-repeat to create a list of paper buttons, which have a custom attribute that I set. The html template for the custom element is a bit complicated but here is an example that illustrates the core issue:
<my-element>
has an propertyexperiments
which gets updated frequently with new data.experiments
is used to generate a list of<paper-button>
with a custom attributelabel
that's set toitem.name
.Let's set
experiments = [{ name: "joe", job: "plumber"}, { name: "cat", job: "maker"}]
Let's call the first paper button,
button
. I would expectbutton.getAttribute(label) === joe
andbutton.label === undefined
. That's not the case. Some magic setsbutton.label
tojoe
. That's fine. It could be useful magic.Now let's set
experiments = [{name: "cat", job: "maker"}]
. I would expectbutton.getAttribute(label) === cat
, and indeed that's correct. Butbutton.label === joe
.Why is this happening?
It feels like a bug because I'd expect reused elements not have zero state that indicates they were used for anything else before.
Here is a jsbin with this example:
http://jsbin.com/hetazocaye/6/edit?html,js,console,output
Strangely div does the right thing.
http://jsbin.com/rekavifozu/3/edit?html,js,console,output
The text was updated successfully, but these errors were encountered: