Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stopPropagation修正 #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Browser/browser-ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ node.addEventListener('click',(event) =>{
- `once`,布尔值,值为 `true` 表示该回调只会调用一次,调用后会移除监听
- `passive`,布尔值,表示永远不会调用 `preventDefault`

一般来说,我们只希望事件只触发在目标上,这时候可以使用 `stopPropagation` 来阻止事件的进一步传播。通常我们认为 `stopPropagation` 是用来阻止事件冒泡的,其实该函数也可以阻止捕获事件。`stopImmediatePropagation` 同样也能实现阻止事件,但是还能阻止该事件目标执行别的注册事件。
一般来说,我们只希望事件只触发在目标上,这时候可以使用 `stopPropagation` 来阻止事件的进一步传播。`stopImmediatePropagation` 同样也能实现阻止事件冒泡,但是还能阻止该事件目标执行同类型注册事件。目标对象存在冒泡事件和捕获事件,执行顺序由注册顺序决定

```js
node.addEventListener('click',(event) =>{
Expand Down