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

147.[js]什么是事件传播? #147

Open
webVueBlog opened this issue Mar 31, 2020 · 2 comments
Open

147.[js]什么是事件传播? #147

webVueBlog opened this issue Mar 31, 2020 · 2 comments
Labels
JavaScript JavaScript

Comments

@webVueBlog
Copy link
Member

[软技能]

@webVueBlog webVueBlog added the JavaScript JavaScript label Mar 31, 2020
@webVueBlog
Copy link
Member Author

捕获阶段–事件从 window 开始,然后向下到每个元素,直到到达目标元素。
目标阶段–事件已达到目标元素。
冒泡阶段–事件从目标元素冒泡,然后上升到每个元素,直到到达 window。

@webVueBlog
Copy link
Member Author

当事件发生在DOM元素上时,该事件并不完全发生在那个元素上。在“冒泡阶段”中,事件冒泡或向上传播至父级,祖父母,祖父母或父级,直到到达window为止;而在“捕获阶段”中,事件从window开始向下触发元素 事件或event.target。

@webVueBlog webVueBlog changed the title 147.[软技能]什么是事件传播? 147.[js]什么是事件传播? Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript JavaScript
Projects
None yet
Development

No branches or pull requests

1 participant