From d01a7b1bf13525521b7b21366772832a1491c870 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Mon, 9 Nov 2020 00:54:39 +0530 Subject: [PATCH] element-child-content - Clarify parentNode and parentElement Also added correct info about topmost node and element. --- docs/element-child-content.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/element-child-content.mdx b/docs/element-child-content.mdx index 59dad54..cbfcdf5 100644 --- a/docs/element-child-content.mdx +++ b/docs/element-child-content.mdx @@ -38,7 +38,9 @@ Text nodes are not elements, so they don't have any tagName. To identify the typ `Node.parentNode: Element | Document | DocumentFragment | null` -This property returns **the parent node** of the current node. If there is no parent, it returns null (which is always true in the case of Document and DocumentFragment). +This property returns **the parent node** of the current node. If there is no parent, it returns null. In case of Document and DocumentFragment, `.parentNode` is always null. + +The topmost parentNode in DOM is `document`. This can be used to check if an element is detached from the DOM. ```js
@@ -52,7 +54,7 @@ child.parentNode //