views:

22

answers:

1

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?

A: 

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".

動靜能量