最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - `querySelector` traversal by order of the number of child nodes? - Stack Overflow

programmeradmin2浏览0评论

In the MDN documentation, it says

The matching is done using depth-first pre-order traversal of the document's nodes starting with the first element in the document's markup and iterating through sequential nodes by order of the number of child nodes.

But I can't find any other information about this behavior on the Internet. And when asking ChatGPT, it says this wording must be an error.

I'm totally new to javascript and don't know who is right, but I do think an official reference such as the MDN can't be wrong, so can someone explains why it uses this specific order?

发布评论

评论列表(0)

  1. 暂无评论