File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -221,8 +221,8 @@ it has found one:
221221``` {sandbox: "homepage"}
222222function talksAbout(node, string) {
223223 if (node.nodeType == Node.ELEMENT_NODE) {
224- for (let i = 0; i < node.childNodes.length; i++ ) {
225- if (talksAbout(node.childNodes[i] , string)) {
224+ for (let child of node.childNodes) {
225+ if (talksAbout(child , string)) {
226226 return true;
227227 }
228228 }
@@ -236,12 +236,6 @@ console.log(talksAbout(document.body, "book"));
236236// → true
237237```
238238
239- {{index "childNodes property", "array-like object", "Array.from function"}}
240-
241- Because ` childNodes ` is not a real array, we cannot loop over it with
242- ` for ` /` of ` and have to run over the index range using a regular ` for `
243- loop or use ` Array.from ` .
244-
245239{{index "nodeValue property"}}
246240
247241The ` nodeValue ` property of a text node holds the string of text that
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ <h2>Chapter 11</h2>
6767
6868< h2 > Chapter 14</ h2 >
6969
70+ < p > < strong > Page 231</ strong > < em > Moving Through the Tree</ em > : Below
71+ the code example, the text claims
72+ that < code > for</ code > /< code > of</ code > loops don't work on DOM child
73+ lists. But in current (even as of the book's release) browsers they
74+ do.</ p >
75+
7076< p > < strong > Page 234</ strong > (2nd) < em > Creating Nodes</ em > : In the
7177code, “edition” is misspelled as “editon”.</ p >
7278
You can’t perform that action at this time.
0 commit comments