Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in what ways will an event ever need to be set to *capturing*?

After reading this page http://www.quirksmode.org/js/events_order.html, I can't help but say that Microsoft had really gotten the things right when they decided to do bubbling because capturing is just.. unintuitive

hence this question: in what ways will an event ever need to be set to capturing ? or simply in all the projects you've done, when have you ever required an event to be capturing?

like image 870
Name Avatar asked Nov 14 '22 21:11

Name


1 Answers

What Kennebec alluded to in the comments is correct. There are events (focus, blur) which simply do not bubble, but they will still capture. This allows one to still use event delegation with those events. Event delegation using bubbling/capturing is often times cleaner and more efficient.

Here is a good article from Quirks explaining event capturing and why it makes sense when using events like focus and blur: http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html


In my projects, I haven't run into a situation where event capturing was required. However in many places where I've used event bubbling I could have used event capturing instead.

like image 77
Polaris878 Avatar answered Nov 16 '22 23:11

Polaris878