If a jquery event handler returns false, then jquery calls event.preventDefault() and event.stopPropagation(). emitter.emit returns a boolean representing whether the stream is still subscribed to the event, which means it will return false for the last event consumed, which will cause jquery to prevent the default action on the event and stop it from bubbling.
Demonstration: https://jsfiddle.net/85thdopv/1/. What should happen is that "beta" is printed for all clicks, and "alpha" is also printed on the first two clicks. Note that the second time you click on the foo button only causes "alpha" to be printed.
I think the event handler that Kefir.fromEvents registers should be changed to always return undefined. emitter.emit's return value doesn't match up with the meaning of jQuery event listener return values or with the event listener return values of any other environment that I'm familiar with.
If a jquery event handler returns false, then jquery calls
event.preventDefault()
andevent.stopPropagation()
.emitter.emit
returns a boolean representing whether the stream is still subscribed to the event, which means it will return false for the last event consumed, which will cause jquery to prevent the default action on the event and stop it from bubbling.Demonstration: https://jsfiddle.net/85thdopv/1/. What should happen is that "beta" is printed for all clicks, and "alpha" is also printed on the first two clicks. Note that the second time you click on the foo button only causes "alpha" to be printed.
I think the event handler that
Kefir.fromEvents
registers should be changed to always return undefined.emitter.emit
's return value doesn't match up with the meaning of jQuery event listener return values or with the event listener return values of any other environment that I'm familiar with.