-
Notifications
You must be signed in to change notification settings - Fork 1
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
JS 事件捕获与冒泡 #4
Comments
事件传播先后顺序:先捕获再冒泡
结果表明是:事件传播先后顺序:先捕获再冒泡。 |
stopPropagation 阻止事件传播
结果表明:stopPropagation 会阻止接下去的捕获和冒泡 |
目标元素的事件,谁先定义谁先执行
结果表明:目标元素的事件,谁先定义谁先执行 |
但是目标元素有子元素的时候,点击子元素仍然是先触发捕获事件,再触发冒泡事件
结果表明:目标元素有子元素的时候,点击子元素是先触发捕获事件,再触发冒泡事件 |
补充:IE 的阻止捕获和冒泡事件是window.event.cancelBubble,封装一下:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: