开发者

jQuery’s event.stopImmediatePropagation() only prevents events bound afterwards?

开发者 https://www.devze.com 2023-03-04 10:10 出处:网络
I was under the impression that event.stopImmediatePropagation() stopped all other bound event handlers, 开发者_运维知识库but on my current code it only seems to stop events bound after my function th

I was under the impression that event.stopImmediatePropagation() stopped all other bound event handlers, 开发者_运维知识库but on my current code it only seems to stop events bound after my function that calls stopImmediatePropagation. Is this correct, and if so how can I get the result I want without unbinding and rebinding all over the place?


This question was answered by Richard Dalton by pointing out that I was misunderstanding how the system worked.

It is working correctly as handlers are executed in the order that they are bound. So you either need to ensure that you handler that calls stopImmediatePropagation is bound first or find some other way.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号