admin 管理员组

文章数量: 1086019

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?

本文标签: javascriptquerySelector traversal by order of the number of child nodesStack Overflow