Fixes https://github.com/atom/vim-mode/issues/863
Fixes https://github.com/atom/atom/issues/8845
---
Re-applying this commit because it was accidentally merged from stable to
beta and master with `--strategy ours` (discarding the changes) instead of
`-X ours` (discarding conflicting changes).
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
This extends the command registry to support listeners registered on
individual elements in addition to selectors. The analogy is inline
styles vs selector-based styles. I’m hoping this will be the foundation
of integrating cleanly with legacy commands registered via our
jQuery::command extension.
Previously, stopping propagation would work on the synthetic bubbling
phase of the command registry itself, but the original event would
continue to propagate which is counterintuitive.
This commit adds the ability to get and restore snapshots of command
listeners. Whatever commands are installed before specs begin are
preserved, but commands added during specs are always cleared away.