This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Node.rootNode read-only property returns a Node object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. This is found by walking backward along Node.parentNode until the top is reached.

Important: For compatibility reasons, this property has been replaced by the Node.getRootNode() method.


rootNode = node.rootNode;


A Node object representing the topmost node in the tree.


Running the following line in supporting browsers should return a reference to the HTML/document node:



Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. Therefore a node obtained, for example, using Node.firstChild or Node.previousSibling may refer to a whitespace text node rather than the actual element the author intended to get.

See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support[1] No support[1] ? No support ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? No support[1] ? No support[1] ?

[1] This property has been removed, and replaced with the Node.getRootNode() method.


Specification Status Comment
The definition of 'Node.rootNode' in that specification.
Living Standard Initial definition

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, Ephys, pasuk, teoli, Sheppy
 Last updated by: chrisdavidmills,