2

有人可以举一个简单的例子来说明我们可以在哪里使用捕获模式而不是 Flash Player 事件的冒泡模式?

大多数时候我们使用冒泡模式并且我们设置useCapture为 false(当添加一个事件监听器时)。使用捕获阶段的理想情况是什么?

4

1 回答 1

2

Basically if you want to stop propagation, you should use the capturing phase. For example, you have a default keyboard listener, and you want to cancel that in a rare condition. There are some points when you may want to use the capturing phase, but those can be achieved without it. To understand capturing and bubbling phase, see image below:

enter image description here

于 2013-05-15T06:30:34.737 回答