[Bug 25458] [Shadow]: The return type of Event.path should be EventTarget[], instead of NodeList

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25458

--- Comment #22 from Hayato Ito <hayato@chromium.org> ---
(In reply to Domenic Denicola from comment #20)
> It should not be a new array on each get; it should be the same array.
> Otherwise e.path !== e.path.
> 
> You should create the array object upon construction of the event, and
> return the same one each time.
> 
> I also think the issues you linked to are not really related to the problem
> at hand.

The situation might be complex here in event.path.
The return value of event.path can differ even in the lifecycle of the same
event object.

For example,

- an event listener, A, is added to a node, NODE_A.
- an event listener, B, is added to a node, NODE_B.
- Suppose NODE_A and NODE_B are in the different node trees.
- Suppose NODE_A and NODE_B are in the same event path for an event. (Don't
confuse "event path" with event.path API).

Suppose, an event listener A is invoked at first. Then an event listener B is
invoked.

var pathInA;

function eventListenerA(event) {
  pathInA = event.path;
  // pathInA is something like [D, C, A] here.
}

function eventListenerB(event) {
  var pathInB = event.path;
  // pathInB is something like [D, C, B] here, which is different what we saw
in eventListenerA.
  // pathInA and pathInB should be the same JavaScript Array object?
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 1 May 2014 05:53:47 UTC