Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b6919c2

Browse filesBrowse files
committed
25 done
1 parent 71327cf commit b6919c2
Copy full SHA for b6919c2

File tree

Expand file treeCollapse file tree

1 file changed

+52
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+52
-0
lines changed
Open diff view settings
Collapse file
+52Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Understanding JavaScript's Capture</title>
6+
</head>
7+
<body class="bod">
8+
9+
<div class="one">
10+
<div class="two">
11+
<div class="three">
12+
</div>
13+
</div>
14+
</div>
15+
16+
<style>
17+
html {
18+
box-sizing: border-box;
19+
}
20+
*, *:before, *:after { box-sizing: inherit; }
21+
22+
div {
23+
width:100%;
24+
padding:100px;
25+
}
26+
27+
.one {
28+
background: thistle;
29+
}
30+
31+
.two {
32+
background:mistyrose;
33+
}
34+
35+
.three {
36+
background:coral;
37+
}
38+
</style>
39+
40+
<button></button>
41+
<script>
42+
const divs = document.querySelectorAll('div')
43+
44+
function logText(e) {
45+
// e.stopPropagation()
46+
console.log(this.classList.value)
47+
}
48+
49+
divs.forEach(div => div.addEventListener('click', logText, {capture: false, once: true}))
50+
</script>
51+
</body>
52+
</html>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.