Using querySelector on Node
I am doing something like:
The above will not work because
querySelector
is not from Node
, but rather Element
. Is there any good way to do this without manually tossing around Nodes?4 Replies
Btw, my example is contrived, the real world use case is different. I really can't do it with just one
querySelectorAll
call in my case.even though the returned type is
NodeList
, only elements can match a (non-pseudo-element) selector
and I don't think querySelector(All)
works with pseudo-element selectorsSo I could just cast it?
yeah