You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 300338a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: 2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/solution.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
1. Yes, true. The element `elem.lastChild` is always the last one, it has no `nextSibling`.
2
-
2. No, wrong, because `elem.children[0]` is the first child *among elements*. But there may exist non-element nodes before it. So `previousSibling` may be a text node. Also, if there are no children, then trying to access `elem.children[0]`
2
+
2. No, wrong, because `elem.children[0]` is the first child *among elements*. But there may exist non-element nodes before it. So `previousSibling` may be a text node.
3
3
4
4
Please note: for both cases if there are no children, then there will be an error.
0 commit comments