Reputation: 1020
I want to perform querySelectorAll
on local dom
of polymer element. I guess that doing simply:
querySelectorAll("some selector");
is not good idea because of all that mistic shady/shadow dom implementation details. I have tried several different ways:
var lst = Polymer.dom(root).querySelectorAll(".qtest");
gives wrapper around js array:
var lst2 = querySelectorAll(".qtest");
gives implementation of ElementList
:
var lst3 = convertToDart(Polymer.dom(root).querySelectorAll(".qtest"));
is just simple List
of elements:
In short: what's the proper way of calling querySelectorAll()
that returns ElementList
from local dom
?
Upvotes: 2
Views: 925
Reputation: 657308
Polymer.dom(root).querySelectorAll('some selector');
Using this Polymer API ensures that you get what you want even when shady DOM or shadow DOM polyfills are used.
See also What are the different ways to look up elements in Polymer 1.0
Upvotes: 2