Open eriklumme opened 6 years ago
This seems to be the case with other properties such as raised
too, but not properties not defined in the paper-button
such as my-attribute
.
Instead of setting active
twice, one can set raised
once and then active
, at which point raised
will be false and active
will be true. I.e. the first time any property defined in paper-button
is set, it is not updated. After that, all properties are immediately updated.
That happens because these properties do reflectToAttribute
and have a default value, e.g. see active
property.
I'd suggest to set the property instead of the attribute, e.g.
ready() {
super.ready();
const paperButton = this.querySelector('paper-button');
paperButton.active = true;
console.log(paperButton.hasAttribute('active')); // true \o/
}
Description
Imperatively setting the
active
attribute of apaper-button
inserted into a slot requires setting it twice before it is updated.Expected outcome
The attribute is updated the first time.
Actual outcome
The attribute is not updated until the second time.
Live Demo
https://jsbin.com/lalarivoli/1/edit?html,console,output
Steps to reproduce
ready()
, set theactive
attribute of the<paper-button>
in the slot to true.<paper-button>
into the slot.Browsers Affected