Is there a way to get all text nodes in a HTML document? I mean something like
document.getElementsByTagName("div")
but for text nodes?
Or, do I have to walk the DOM to get them?
Is there a way to get all text nodes in a HTML document? I mean something like
document.getElementsByTagName("div")
but for text nodes?
Or, do I have to walk the DOM to get them?
NodeIterator
with NodeFilter.SHOW_TEXT
.
https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator