Why does jQuery event model does not support event Capture and just supports event bubbling
Asked Answered
D

2

20

Why does jQuery event model does not support event Capture and just supports event bubbling?

Dispread answered 23/8, 2011 at 15:31 Comment(0)
N
14

Because not all browsers support event capturing, especially IE. As jQuery is supposed to be cross-browser compatible, it cannot offer event capturing (it might be possible to simulate event capturing, but if it were easy, I'm sure they would have done it).

Nomarch answered 23/8, 2011 at 15:54 Comment(3)
IMHO, jquery 2.x should support itYep
That's a very bad reason not to support something. at least give the user the power to choose. I think the power of events namespacing is very convenient with jQuery and not so with native JS.Faulk
well a lot of things doesn't work in IE, but usefull libraries has been created. BummerUnderestimate
W
7

This was infact a desirable feature in jQuery 2 but the core-team was pretty much convinced that allowing capturing events to have equal standing throughout the entire jQuery event system would open up a whole lot of issues. The original ticket can be found here[1]. They even closed the ticket after few discussions.

Moreover, browsers older then IE8 and Opera 7.0 does not support event capturing. Since the primary goal of jQuery is to provide cross-browser support, it does not support event capturing.

On a lighter note, it seems jQuery is more focused to leverage Event Delegation which is based on bubbling of events up to the DOM tree.

[1] http://bugs.jquery.com/ticket/14953

Winwaloe answered 6/12, 2014 at 7:4 Comment(1)
The whole point of jquery 2.0 is to drop support for older browsers, so older browsers not supporting event capturing should not be a blocker for jquery 2 at least.Fructidor

© 2022 - 2024 — McMap. All rights reserved.