I\'m having trouble understanding when access to the shadowRoot of a component is available. Here is an image of a set of nested components:
I find your description difficult to understand but usually in attached
after the super.attached();
call all things are proper initialized.
If you can provide the minimal code that allows to reproduce your problem it would be easier to make concrete suggestions.
In core-elements (JavaScripts) ready()
callback is used most of the time instead of attached
. I haven't investigated which one is called earlier/later because attached
(was enteredView
) never failed me.
Typically, if you're extending PolymerElement
the order of the main callbacks will be ready
, created
, attached
. These happen top-down: they're called on ancestors before descendants. It might confusing that ready
is called first, but it's because PolymerElement.created
calls it after setting up the DOM and even handlers, and because of constructor ordering that happens before your classes created
constructor.
Polymer also adds a domReady
method that you can override which is called when your element's children are guaranteed to have been created. That might be what you need.
See http://www.polymer-project.org/docs/polymer/polymer.html#lifecyclemethods for details on the lifecycle methods.
First I would see if you can sidestep the ordering issue with data-binding and declarative events, though.