element-properties - minor fixes

This commit is contained in:
2020-11-04 19:05:17 +05:30
parent e7d6796921
commit 23993089d8
+2 -3
View File
@@ -140,7 +140,7 @@ childNodes // NodeList [text, span, text]
:::note Is there any child node? :::note Is there any child node?
`Node.hasChildNodes() : boolean` `Node.hasChildNodes() : boolean`
This method returns a boolean value, indicating whether the given Node **has child nodes or not**. This method checks whether the given node **has child nodes or not** and returns a boolean value.
This is equivalent to checking `node.childNodes.length > 0`. This is equivalent to checking `node.childNodes.length > 0`.
@@ -152,7 +152,6 @@ This is equivalent to checking `node.childNodes.length > 0`.
`Element.firstChild: Node` `Element.firstChild: Node`
This property returns the element's **first child** node in the tree. If the node has no children, then it returns `null`. This property returns the element's **first child** node in the tree. If the node has no children, then it returns `null`.
`Element.nextSibling: Node` `Element.nextSibling: Node`
@@ -172,7 +171,7 @@ var eleC = eleB.nextSibling // <div id="C"/>
eleC.nextSibling // null eleC.nextSibling // null
``` ```
There is also a similar `previousSibling` property, which returns the previous node. Also, there are element-only variant for all these properties like `firstElementChild`, `nextElementSibling`, etc. There is also a similar `previousSibling` property which returns the previous node. Also, there are element-only variants like `firstElementChild`, `nextElementSibling`, etc.
<Accordion title="Why is this useful?"> <Accordion title="Why is this useful?">