1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| <!DOCTYPE html>
| <html lang="en">
| <head>
| <meta charset="UTF-8">
| </head>
| <body>
| <div>
| <button>click</button>
| </div>
| <script>
| const div = document.querySelector("div");
| const button = document.querySelector("button");
|
| function doSomething(e) {
| console.log("capture");
| }
|
| function click(e) {
| console.log("bubble");
| }
|
| div.addEventListener("click", doSomething, true);
|
| button.addEventListener("click", click, false /* default */);
| </script>
| </body>
| </html>
|
|