Most of the time I see code registering an event listener for a link or a div or button, and handle everything from there. But the event capturing and bubbling is good to handle开发者_开发问答 events at the offspring and then at the ancestor level. But what is a good example we will want to listen at 2 different places?
I saw an example in a book:
if you are designing a "whack a mole" game, you want to listen to the event of the mole div to know of a "hit" and the empty space in the parent div, so as to know a "miss".
精彩评论