On Chrome and old iOS etc., we track updates to native properties via MutationObserver. This means that we hear about the updates asynchronously, even if the app calls deliver().
As a corollary, initial processing for parameters like value in new Switch({value: ...}) also happen asynchronously, even though deliver() is called on creation. (Inconsistently, we handle <d-switch value=....> synchronously.)
I think this can be fixed by using the code in CustomElement#createdCallback():
// Call custom setters for initial values of attributes with shadow properties (dir, tabIndex, etc)
attrs.forEach(function (attrName) {
if (this.hasAttribute(attrName)) { // initial value was specified
var value = this.getAttribute(attrName);
this.removeAttribute(attrName);
setterMap[attrName].call(this, value); // call custom setter
}
}, this);
And doing it also/instead in deliver().
Then clean up setTimeout() "workarounds" in test files like deliteful/tests/unit/ToggleButton.js.
On Chrome and old iOS etc., we track updates to native properties via MutationObserver. This means that we hear about the updates asynchronously, even if the app calls
deliver()
.As a corollary, initial processing for parameters like
value
innew Switch({value: ...})
also happen asynchronously, even thoughdeliver()
is called on creation. (Inconsistently, we handle<d-switch value=....>
synchronously.)I think this can be fixed by using the code in CustomElement#createdCallback():
And doing it also/instead in
deliver()
.Then clean up
setTimeout()
"workarounds" in test files like deliteful/tests/unit/ToggleButton.js.