JS事件绑定的事件是按照顺序执行的吗
2个回答
展开全部
JS绑定的同步事件是按照绑定顺序执行的。W3C对此有相关规范,原文内容如下:
Events which are synchronous (sync events) are treated as if they are in a virtual queue in a first-in-first-out model, ordered by sequence of temporal occurrence with respect to other events, to changes in the DOM, and to user interaction. Each event in this virtual queue is delayed until the previous event has completed its propagation behavior, or been canceled.
简单的翻译一下:
同步事件被看做有一个虚拟的先进先出的队列,按照绑定的时间的顺序进行DOM操作或者用户交互。每一个虚拟队列中的事件都会一直等待直到他前面的那个事件传播(冒泡或捕获)结束或者被取消。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询