Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Event listener execution order is backwards when useCapture = true #64

Open
lazd opened this issue Nov 11, 2014 · 1 comment
Open

Event listener execution order is backwards when useCapture = true #64

lazd opened this issue Nov 11, 2014 · 1 comment
Labels
bug Something isn't working library Relates to an Origami library
Projects

Comments

@lazd
Copy link
Contributor

lazd commented Nov 11, 2014

It seems event listeners fire in the wrong order when useCapture = true. See this Fiddle.

With this markup:

<div id="node0">
  <div id="node1">
    <div id="node2">
    </div>
  </div>
</div>

And with listeners added on the capture phase:

var events = new domDelegate.Delegate(document.querySelector('#node0'));

events.on('click', handler0, true);

events.on('click', '#node1', handler1, true);

events.on('click', '#node2', handler2, true);

For an event triggered on #node2:

document.querySelector('#node2').click();

One would expect the following call order, which matches that of native event listeners.

  • handler0
  • handler1
  • handler2

Instead, we get:

  • handler2
  • handler1
  • handler0
orangemug added a commit to orangemug/dom-delegate that referenced this issue Oct 4, 2016
@orangemug
Copy link
Contributor

There is fix on branch master...orangemug:fix/issue-64

This continues on work from #73 ...which in turn is waiting on PR #81 (all the PR's!)

@chee chee added this to incoming in Origami ✨ Feb 1, 2020
@JakeChampion JakeChampion added bug Something isn't working library Relates to an Origami library labels Mar 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working library Relates to an Origami library
Projects
Origami ✨
  
Backlog
Development

No branches or pull requests

3 participants