Skip to content

Commit 217eb0e

Browse files
committed
minor
1 parent de725bd commit 217eb0e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

2-ui/2-events/02-bubbling-and-capturing/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Let's start with an example.
55
This handler is assigned to `<div>`, but also runs if you click any nested tag like `<em>` or `<code>`:
66

77
```html autorun height=60
8-
<div onclick="alert('The handler !')">
8+
<div onclick="alert('The handler!')">
99
<em>If you click on <code>EM</code>, the handler on <code>DIV</code> runs.</em>
1010
</div>
1111
```

2-ui/2-events/02-bubbling-and-capturing/bubble-target.view/script.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
form.onclick = function(event) {
33
event.target.style.backgroundColor = 'yellow';
44

5-
alert("target = " + event.target.tagName + ", this=" + this.tagName);
6-
7-
event.target.style.backgroundColor = '';
5+
// chrome needs some time to paint yellow
6+
setTimeout(() => {
7+
alert("target = " + event.target.tagName + ", this=" + this.tagName);
8+
event.target.style.backgroundColor = ''
9+
}, 0);
810
};

0 commit comments

Comments
 (0)