InterviewMap / CS-Interview-Knowledge-Map

Build the best interview map. The current content includes JS, network, browser related, performance optimization, security, framework, Git, data structure, algorithm, etc.
https://yuchengkai.cn/docs/frontend/
18.3k stars 2.57k forks source link

浏览器->事件机制中事件捕获和冒泡的源头应该是window #119

Closed ChenXiaoSong12321 closed 6 years ago

ChenXiaoSong12321 commented 6 years ago

有个疑问,Document 对象是 Window 对象的一部分,给window和document都绑定事件,点击时会先触发window上的事件再触发document上的事件,所以个人认为事件捕获和冒泡的源头应该是window,望解惑,谢谢。

naihe138 commented 6 years ago

@Jerry12138 是的,这里有解惑哦https://www.w3.org/TR/DOM-Level-3-Events/#dom-event-architecture