Why doesn't Node.js have a native DOM?

前端 未结 13 1680
既然无缘
既然无缘 2020-11-28 08:32

When I discovered that Node.js was built using the V8 JavaScript engine, I thought:

Great, web scraping will be easier as the page

13条回答
  •  甜味超标
    2020-11-28 08:56

    Because there isn't a DOM. DOM stands for Document Object Model. There is no document in Node, so not DOM to manipulate it. That is definitively a browser thing.

    You can use a library like cheerio though which gives you some simple DOM manipulation.

    Node is server-level JavaScript. It's just the language applied to a basic system API, more like C++ or Java.

提交回复
热议问题