5

Now that I've realized that executing a function like

let parser = new DOMParser();

works only when it's executed with a browser, but not with a server like Express/Node, then, what are the options?

I've read many posts with NodeJS alternatives to DOMParser, but then there're the libraries

https://www.npmjs.com/package/dom-parser

https://www.npmjs.com/package/dom-node-iterator

Are these ones valid alternatives? Do I install them and adapt the method calls depending on whether it is the browser or Node the one that uses them?

I'm asking because looking at posts like this one HTML-parser on Node.js it doesn't seem so simple

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.