This commit is contained in:
Ilya Kantor 2017-10-14 23:52:37 +03:00
parent de725bd171
commit 217eb0e5fa
2 changed files with 6 additions and 4 deletions

View file

@ -5,7 +5,7 @@ Let's start with an example.
This handler is assigned to `<div>`, but also runs if you click any nested tag like `<em>` or `<code>`:
```html autorun height=60
<div onclick="alert('The handler !')">
<div onclick="alert('The handler!')">
<em>If you click on <code>EM</code>, the handler on <code>DIV</code> runs.</em>
</div>
```

View file

@ -2,7 +2,9 @@
form.onclick = function(event) {
event.target.style.backgroundColor = 'yellow';
alert("target = " + event.target.tagName + ", this=" + this.tagName);
event.target.style.backgroundColor = '';
// chrome needs some time to paint yellow
setTimeout(() => {
alert("target = " + event.target.tagName + ", this=" + this.tagName);
event.target.style.backgroundColor = ''
}, 0);
};