diff --git a/docs/element-properties.mdx b/docs/element-properties.mdx index abce158..86e1613 100644 --- a/docs/element-properties.mdx +++ b/docs/element-properties.mdx @@ -10,7 +10,7 @@ import MDN from "../components/MDNBadge" ### 1. tagName -`Element.tagName : string` +`Element.tagName: string` `.tagName` is a read-only property on any element, which returns the tag name in uppercase form. This is useful to identify type of a element. @@ -32,7 +32,22 @@ Text nodes are not element, so they don't have any tagName. To identify the type   - + +### 2. parentElement + +`Node.parentElement: Element | null` + +`.parentElement` property returns **the parent element** of the current node. If the node doesn't have a parent, it returns null. + +Usually, the last parent will be `document` - which itself doesn't have a parent. + +```js +
+
+
+ +child.parentElement //
-### 3. childNodes +### 4. childNodes `Node.childNodes: NodeList` @@ -148,7 +163,7 @@ This is equivalent to checking `node.childNodes.length > 0`. -### 4. firstChild + nextSibling +### 5. firstChild + nextSibling `Element.firstChild: Node` @@ -219,8 +234,6 @@ traverse(root.firstChild)