@@ -97,13 +97,13 @@ node is `document.body`. Some of these children can be ((leaf node))s,
97
97
such as pieces of ((text)) or ((comment))s (which are written between
98
98
`<!--` and `-->` in HTML).
99
99
100
- (((ELEMENT_NODE code )))(((COMMENT_NODE code)))(((TEXT_NODE
101
- code)))(((nodeType property)))Each DOM node object has a `nodeType`
102
- property, which contains a numeric code that identifies the type of
103
- node. Regular elements have the value 1, which is also defined as the
104
- constant property `document.ELEMENT_NODE`. Text nodes, representing a
105
- section of text in the document, have the value 3
106
- (`document.TEXT_NODE`). Comments get the value 8
100
+ (((text node )))(((ELEMENT_NODE code)))(((COMMENT_NODE
101
+ code)))(((TEXT_NODE code)))((( nodeType property)))Each DOM node object
102
+ has a `nodeType` property, which contains a numeric code that
103
+ identifies the type of node. Regular elements have the value 1, which
104
+ is also defined as the constant property `document.ELEMENT_NODE`. Text
105
+ nodes, representing a section of text in the document, have the value
106
+ 3 (`document.TEXT_NODE`). Comments get the value 8
107
107
(`document.COMMENT_NODE`).
108
108
109
109
So another way to visualize our document ((tree)) is:
@@ -178,7 +178,7 @@ will be null, and for a last child, `nextSibling` is null.
178
178
179
179
(((talksAbout function)))(((recursion)))(((nesting,of objects)))When
180
180
dealing with a nested data structure like this, recursive functions
181
- are often useful. The one below scans a document for text nodes
181
+ are often useful. The one below scans a document for (( text node))s
182
182
containing a given string, and returns `true` when it has found one.
183
183
184
184
[[talksAbout]]
@@ -328,9 +328,9 @@ but adding a new text node to replace them. For this, we use the
328
328
</script>
329
329
----
330
330
331
- Given a string, `createTextNode` gives us a type 3 DOM node (a text
332
- node), which we can insert into the document to make it show up on the
333
- screen.
331
+ (((text node))) Given a string, `createTextNode` gives us a type 3 DOM
332
+ node (a text node ), which we can insert into the document to make it
333
+ show up on the screen.
334
334
335
335
(((live data structure)))(((getElementsByTagName
336
336
method)))(((childNodes property)))The loop that goes over the images
@@ -475,10 +475,11 @@ the node. We loop over all matches of the keyword expression,
475
475
appending the text _between_ them as regular text nodes, and the text
476
476
matched as text nodes wrapped in `<strong>` (bold) elements.
477
477
478
- (((getElementsByTagName method)))We can automatically highlight all
479
- programs on the page by looping over all the `<pre>` elements that
480
- have a `data-language` attribute, and calling `highlightCode` on each
481
- one with the correct regular expression for the language.
478
+ (((data attribute)))(((getElementsByTagName method)))We can
479
+ automatically highlight all programs on the page by looping over all
480
+ the `<pre>` elements that have a `data-language` attribute, and
481
+ calling `highlightCode` on each one with the correct regular
482
+ expression for the language.
482
483
483
484
// include_code
484
485
@@ -1134,7 +1135,7 @@ a recursive call on it to inspect its own children.
1134
1135
1135
1136
=== The cat's hat ===
1136
1137
1137
- (((cat's hat exercise)))Extend the cat ((animation)) defined
1138
+ (((cat's hat ( exercise) )))Extend the cat ((animation)) defined
1138
1139
link:13_dom.html#animation[earlier] so that both the cat and his hat
1139
1140
(`<img src="img/hat.png">`) orbit, at opposite sides of the ellipse.
1140
1141
0 commit comments