As per my understanding of XPath, for any HTML or XML document:$x("/node()") means $x("/child::node()") which means return the node which is a child of the context node. Here, the root node(/) is the context node. Therefore, it returns the html element.
$x("node()") means $x("child::node()") which also returns the same html element. But in this case, we have not provided the context node unlike in the above case. So, how does it identify the context node in this case ?
Also, are both the above XPath expressions syntactically and functionally same.
/node(). And while XPath does not know DOCTYPE nodes I think in Chrome$x('/node()')will also include such a DOCTYPE node if present in the HTML document or probably XML document as well. - Martin Honnen