DenoDDeno
Powered by
abiA
Denoβ€’3y agoβ€’
5 replies
abi

Using querySelector on Node

I am doing something like:
const nodeList: NodeList = document.querySelectorAll(".foo");
const nodes = [...nodeList];
const result = nodes.map((n: Node) => n.querySelector("span"));
const nodeList: NodeList = document.querySelectorAll(".foo");
const nodes = [...nodeList];
const result = nodes.map((n: Node) => n.querySelector("span"));

The above will not work because
querySelector
querySelector
is not from
Node
Node
, but rather
Element
Element
. Is there any good way to do this without manually tossing around Nodes?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

error Unsupported scheme node for module `nodemodule`. Supported schemes
PixelPPixel / help
4y ago
using both nodejs & deno
dan.the.discloserDdan.the.discloser / help
4y ago
Axios always 404 when using using proxies compared to Node.JS
cnslCcnsl / help
15mo ago
node-pre-gyp problem on macOs
OxooxoOOxooxo / help
14mo ago