We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05b852a commit 28d08b4Copy full SHA for 28d08b4
docs/dom/node.md
@@ -558,7 +558,7 @@ wrapper.childNodes.length // 1
558
559
### Node.prototype.getRootNode()
560
561
-`getRootNode`方法返回当前节点所在文档的根节点,与`ownerDocument`属性的作用相同。
+`getRootNode()`方法返回当前节点所在文档的根节点`document`,与`ownerDocument`属性的作用相同。
562
563
```javascript
564
document.body.firstChild.getRootNode() === document
@@ -567,3 +567,10 @@ document.body.firstChild.getRootNode() === document.body.firstChild.ownerDocumen
567
// true
568
```
569
570
+该方法可用于`document`节点自身,这一点与`document.ownerDocument`不同。
571
+
572
+```javascript
573
+document.getRootNode() // document
574
+document.ownerDocument // null
575
+```
576
0 commit comments