Skip to content

Commit 872cc6a

Browse files
authored
Merge pull request #2195 from joaquinelio/patch-1
Winnie Pooh case... : )
2 parents 8ccc7f6 + 54df94d commit 872cc6a

File tree

1 file changed

+2
-2
lines changed
  • 2-ui/1-document/05-basic-dom-node-properties

1 file changed

+2
-2
lines changed

2-ui/1-document/05-basic-dom-node-properties/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,15 @@ Compare the two:
397397
<div id="elem2"></div>
398398
399399
<script>
400-
let name = prompt("What's your name?", "<b>Winnie-the-pooh!</b>");
400+
let name = prompt("What's your name?", "<b>Winnie-the-Pooh!</b>");
401401
402402
elem1.innerHTML = name;
403403
elem2.textContent = name;
404404
</script>
405405
```
406406
407407
1. The first `<div>` gets the name "as HTML": all tags become tags, so we see the bold name.
408-
2. The second `<div>` gets the name "as text", so we literally see `<b>Winnie-the-pooh!</b>`.
408+
2. The second `<div>` gets the name "as text", so we literally see `<b>Winnie-the-Pooh!</b>`.
409409
410410
In most cases, we expect the text from a user, and want to treat it as text. We don't want unexpected HTML in our site. An assignment to `textContent` does exactly that.
411411

0 commit comments

Comments
 (0)