Skip to content

Commit c622f3c

Browse files
authored
Up until Cloning Nodes
1 parent 2a3182a commit c622f3c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

2-ui/1-document/07-modifying-document/article.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Here we'll see how to create new elements "on the fly" and modify the existing p
66

77
First we'll see a simple example and then explain the methods.
88

9-
[cut]
10-
119
## Example: show a message
1210

1311
For a start, let's see how to add a message on the page that looks nicer than `alert`.
@@ -32,7 +30,7 @@ Here's how it will look:
3230
*/!*
3331
```
3432

35-
That was an HTML example. Now let's create the same `div` with JavaScript (assuming that the styles are still in the HTML or an external CSS).
33+
That was an HTML example. Now let's create the same `div` with JavaScript (assuming that the styles are still in the HTML or an external CSS file).
3634

3735
## Creating an element
3836

@@ -63,7 +61,7 @@ div.className = "alert alert-success";
6361
div.innerHTML = "<strong>Hi there!</strong> You've read an important message.";
6462
```
6563

66-
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.
6765

6866
## Insertion methods
6967

@@ -137,9 +135,8 @@ Here's a brief list of methods to insert a node into a parent element (`parentEl
137135
*/!*
138136
</script>
139137
```
140-
141-
To insert as the first element, we can do like this:
142-
138+
To insert `newLi` as the first element, we can do it like this:
139+
143140
```js
144141
list.insertBefore(newLi, list.firstChild);
145142
```
@@ -206,7 +203,7 @@ before
206203
after
207204
```
208205

209-
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.
210207

211208
For instance, here a string and an element are inserted:
212209

0 commit comments

Comments
 (0)