Event Capturing vs Event Bubbling
Posted
by Rajat
on Stack Overflow
See other posts from Stack Overflow
or by Rajat
Published on 2010-04-18T05:10:31Z
Indexed on
2010/04/18
5:13 UTC
Read the original article
Hit count: 520
JavaScript
|javascript-events
I just wanted to get the general consensus on which is a better mode of event delegation in JS between bubbling and capturing.
Now I understand that depending on a particular use-case, one might want to use capturing phase over bubbling or vice versa but I want to understand what delegation mode is preferred for most general cases and why (to me it seems bubbling mode).
Or to put it in other words, is there a reason behind W3C addEventListener implementation to favor the bubbling mode. [capturing is initiated only when you specify the 3rd parameter and its true. However, you can forget that 3rd param and bubbling mode is kicked in]
I looked up the JQuery's bind function to get an answer to my question and it seems it doesn't even support events in capture phase (it seems to me because of IE not support capturing mode).
So looks like bubbling mode is the default choice but why?
© Stack Overflow or respective owner