You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/2-events/02-bubbling-and-capturing/article.md
+8-2
Original file line number
Diff line number
Diff line change
@@ -136,9 +136,15 @@ That is: for a click on `<td>` the event first goes through the ancestors chain
136
136
137
137
Handlers added using `on<event>`-property or using HTML attributes or using `addEventListener(event, handler)` don't know anything about capturing, they only run on the 2nd and 3rd phases.
138
138
139
-
To catch an event on the capturing phase, we need to set the event options of `addEventListener` to `{capture: true}` (or just`true`).
139
+
To catch an event on the capturing phase, we need to set the handler `capture` option to`true`:
140
140
141
-
There are two possible values `capture` option:
141
+
```js
142
+
elem.addEventListener(..., {capture:true})
143
+
// or, just "true" is an alias to {capture: true}
144
+
elem.addEventListener(..., true)
145
+
```
146
+
147
+
There are two possible values of the `capture` option:
142
148
143
149
- If it's `false` (default), then the handler is set on the bubbling phase.
144
150
- If it's `true`, then the handler is set on the capturing phase.
0 commit comments