Financial-Times / ftdomdelegate

Create and manage a DOM event delegator
MIT License
320 stars 36 forks source link

stopPropagation does not stop propagation to listeners added with ftdomdelegate #63

Open lazd opened 10 years ago

lazd commented 10 years ago

Basically, calling stopPropagation on a bubble phase listeners should prevent other delegated listeners further up the DOM from being called, but it doesn't.

See this Fiddle here for an example with bubble phase listeners for and this Fiddle for an example with capture phase listeners.

Furthermore, listeners added with addEventListener are still called because the actual call to stopPropagation happens at the level of the root element, stopping propagation above it, but not above the child element where the user called stopPropagation at, see this Fiddle for an example. This is non-trivial to solve, so it should at least be documented. Note that jQuery exhibits the same behavior (but does correctly stop propagation to other listeners added further up the DOM).