当前位置:网站首页>DOM事件流 事件冒泡-事件捕获-事件委托
DOM事件流 事件冒泡-事件捕获-事件委托
2022-07-26 05:04:00 【rananie】
DOM事件流

面试题
- 事件委托,事件代理的优点
- 事件捕获和冒泡的过程
- 事件冒泡和委托?使用场景?
- JS事件绑定的原理
- 什么时候用冒泡?什么时候用捕获?
事件冒泡与事件捕获
目的:解决页面中的事件流(事件发生顺序)的问题
- 事件冒泡:从内到外传递事件
- 事件捕获:从外到内传递事件
绑定事件监听时,第三个参数可以设置事件在哪个阶段执行,默认是事件冒泡阶段
DOM事件流的三个阶段是捕获阶段->目标阶段->冒泡阶段。
当事件处于目标阶段时,事件调用顺序决定于绑定事件的书写顺序
事件代理 - 利用事件冒泡机制
事件代理:事件代理就是利用事件冒泡或事件捕获的机制把一系列的内层元素事件绑定到外层元素。
事件委托的好处
- 减少事件监听绑定的次数,减少内存占用,提升性能
- 绑定的事件对后添加的DOM节点仍然有效
边栏推荐
- 有ggjj看看这个问题没,是否缓存导致跨域问题?
- JVM Lecture 5: how to deal with peak push of vertical and horizontal data
- 未来大气污染变化模拟
- Distance between bus stops: simple simulation problem
- [acwing] 1268. Simple questions
- List converted to tree real use of the project
- What are the characteristics of the grammar of Russian documents in the translation of scientific papers
- MODFLOW Flex、GMS、FEFLOW、HYDRUS实践应用
- There was an unexpected error (type=method not allowed, status=405)
- I talked with the interviewer about MySQL optimization in five dimensions
猜你喜欢

Correspondence between IEC61131 data type and C data type

What are the demand management software for small and medium-sized enterprises

Teach you how to use code to realize SSO single sign on

Redis解决库存超卖问题

阿里三面:MQ 消息丢失、重复、积压问题,如何解决?

CLM陆面过程模式

What is the real HTAP? (1) Background article
![[wp][gwctf 2019] boring lottery](/img/e1/7b0238993aecd185b33e5447ba6720.png)
[wp][gwctf 2019] boring lottery

Textfield and password input box that are more flexible and easy to use in compose

mysql函数汇总之日期和时间函数
随机推荐
Excel VBA: realize automatic drop-down filling formula to the last line
Add and modify the verification logic, and use -validation- to complete the group verification
CMD操作命令
[pytorch] install torch 1.8.1 and check whether torch version and GPU are available
Building blocks for domestic databases, stonedb integrated real-time HTAP database is officially open source!
@Autowired注解的原理
Torch slice maintenance
Stm32fsmc extended SRAM
The importance of supporting horizontal expansion of time series database
LeetCode - 单调栈与单调队列
关于负数表示的数值为什么比整数大1?
推荐12个免费查找文献的学术网站,建议点赞、收藏!
What points should be paid attention to in the selection of project management system?
What are the characteristics of the grammar of Russian documents in the translation of scientific papers
【Leetcode】493. Reverse Pairs
A material of machine learning
I talked with the interviewer about MySQL optimization in five dimensions
CLM陆面过程模式
Axi protocol (5): burst mechanism of Axi protocol
[mathematical modeling] analytic hierarchy process (AHP)