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
div.innerHTML="<strong>Hi there!</strong> You've read an important message.";
62
62
```
63
63
64
-
After that, we have a ready DOM element. Right now it's in the variable, but can not be seen, because not inserted into the page yet.
64
+
After that, we have a ready DOM element. Right now it's in the variable, but can not be seen, because it's not been inserted into the page yet.
65
65
66
66
## Insertion methods
67
67
@@ -135,9 +135,8 @@ Here's a brief list of methods to insert a node into a parent element (`parentEl
135
135
*/!*
136
136
</script>
137
137
```
138
-
139
-
To insert as the first element, we can do like this:
140
-
138
+
To insert `newLi` as the first element, we can do it like this:
139
+
141
140
```js
142
141
list.insertBefore(newLi, list.firstChild);
143
142
```
@@ -204,7 +203,7 @@ before
204
203
after
205
204
```
206
205
207
-
These methods can insert multiple list of nodes and text pieces in a single call.
206
+
These methods can insert multiple lists of nodes and text pieces in a single call.
208
207
209
208
For instance, here a string and an element are inserted:
210
209
@@ -303,7 +302,7 @@ So here's an alternative variant of showing a message:
303
302
304
303
How to insert one more similar message?
305
304
306
-
We could do a function and put the code there. But the alternative way would be to *clone* the existing `div` and modify the text inside it (if needed).
305
+
We could make a function and put the code there. But the alternative way would be to *clone* the existing `div` and modify the text inside it (if needed).
307
306
308
307
Sometimes when we have a big element, that may be faster and simpler.
309
308
@@ -338,7 +337,7 @@ An example of copying the message:
338
337
339
338
## Removal methods
340
339
341
-
To remove nodes, there are following methods:
340
+
To remove nodes, there are the following methods:
342
341
343
342
344
343
`parentElem.removeChild(node)`
@@ -412,7 +411,7 @@ The call to `document.write(html)` writes the `html` into page "right here and n
412
411
413
412
The method comes from times when there were no DOM, no standards... Really old times. It still lives, because there are scripts using it.
414
413
415
-
In modern scripts we can rarely see it, because of the important limitation.
414
+
In modern scripts we can rarely see it, because of the following important limitation:
416
415
417
416
**The call to `document.write` only works while the page is loading.**
418
417
@@ -480,4 +479,4 @@ Insertion and removal of nodes:
480
479
- To append HTML to the page before it has finished loading:
481
480
-`document.write(html)`
482
481
483
-
After the page is loaded such call erases the document. Mostly seen in old scripts.
482
+
After the page is loaded such a call erases the document. Mostly seen in old scripts.
0 commit comments