mardi 9 février 2016

When are Custom Element Properties Initialized?

I can't seem to trigger the getter/setter on the properties I defined of a custom element from its parent.

HTML

<parent-elem>
    <child-elem></child-elem>
</parent-elem>

Javascript in parent element's attachedCallback

var childElem = this.querySelector('child-elem');
childElem.customProperty = true;

but it does not fire the setter for customProperty. If I wrap it in setTimeout() it works fine though, so when are the properties attached to the element? The same time as createdCallback?




Aucun commentaire:

Enregistrer un commentaire