Skip to content

Commit d912bce

Browse files
committed
minor
1 parent fa8ffbe commit d912bce

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

2-ui/2-events/02-bubbling-and-capturing/article.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@ That is: for a click on `<td>` the event first goes through the ancestors chain
136136

137137
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.
138138

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`:
140140

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:
142148

143149
- If it's `false` (default), then the handler is set on the bubbling phase.
144150
- If it's `true`, then the handler is set on the capturing phase.

0 commit comments

Comments
 (0)