PolymerX/polymer-skeleton

document.querySelector("any-component") not working

mib-kamel opened this issue · 3 comments

Hello all

I have a problem in using document.querySelector, document.getElementById or any other selection.

it always gives me null if I want to select anything.

i should choose this.shadowRoot instead of document

Hi @mib-kamel, when you work with shadow dom you can't querySelect element outside the element shadow root (and you should not do it). You can select elements inside the current node shadow-root by using, as you said, this.shadowRoot, this is the standard shadow dom behavior.

thanks