-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path128.js
More file actions
55 lines (50 loc) · 1.19 KB
/
Copy path128.js
File metadata and controls
55 lines (50 loc) · 1.19 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// console.log("hello world");
const grandparent = document.querySelector(".grandparent");
// const parent = document.querySelector(".parent");
// const child = document.querySelector(".child");
// capturing events
// child.addEventListener(
// "click",
// () => {
// console.log("capture !!!! child");
// },
// true
// );
// parent.addEventListener(
// "click",
// () => {
// console.log("capture !!!! parent");
// },
// true
// );
// grandparent.addEventListener(
// "click",
// () => {
// console.log("capture !!!! grandparent");
// },
// true
// );
// document.body.addEventListener(
// "click",
// () => {
// console.log("capture !!!! document.body");
// },
// true
// );
///// not capture
// child.addEventListener("click", () => {
// console.log("bubble child");
// });
// parent.addEventListener("click", () => {
// console.log("bubble parent");
// });
// grandparent.addEventListener("click", () => {
// console.log("bubble grandparent");
// });
// document.body.addEventListener("click", () => {
// console.log("bubble document.body");
// });
// event delegation
// grandparent.addEventListener("click", (e) => {
// console.log(e.target);
// });