Reverse event bubbling in javascript

后端 未结 3 1020
时光说笑
时光说笑 2021-02-08 00:45

As you know, events usually bubble up in javascript, so the event handler of the element that fires the event is executed first, then the event handler of the parent element is

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-08 01:33

    I can see one huge drawback of your solution is fact, that for every handled event you have to traverse DOM upwards starting with this to establish number of parents.

    Traversing in such manner in every event handler = low performance.

提交回复
热议问题