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

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

Description

@lazd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglibraryRelates to an Origami library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions