Skip to content

Commit 15daa76

Browse files
committed
Merge branch 'master' of github.com:wangdoc/javascript-tutorial
2 parents 0be7204 + e5fb800 commit 15daa76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/dom/node.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ while (el !== null) {
178178
var div1 = document.getElementById('d1');
179179
var div2 = document.getElementById('d2');
180180

181-
d2.nextSibling === d1 // true
181+
d2.previousSibling === d1 // true
182182
```
183183

184-
上面代码中,`d2.nextSibling`就是`d2`前面的同级节点`d1`
184+
上面代码中,`d2.previousSibling`就是`d2`前面的同级节点`d1`
185185

186186
注意,该属性还包括文本节点和评论节点。因此如果当前节点前面有空格,该属性会返回一个文本节点,内容为空格。
187187

0 commit comments

Comments
 (0)