Re: [whatwg/dom] event.composedPath() may return different results if DOM is modified between two calls (#525)

@smaug---- and I tried to sketch out a different model here, review appreciated!

> When appending to path assume the arguments in the tuple are always named (target, targetOverride, relatedTarget), in step 5, 9.2.2, and 9.4.2 of https://dom.spec.whatwg.org/#concept-event-dispatch. Assume that invokes an algorithm that runs the following steps before appending the tuple to the path:
> * If target is a shadow root whose mode is "closed", then set root-of-closed-tree to true in the tuple.
> * If target is a slot, target's root is a shadow root whose mode is "closed", targetOverride is non-null, targetOverride is assigned, and targetOverride's assigned slot is target, then set slot-in-closed-tree to true in the tuple.
>
> Then `composedPath()` is defined as follows:
> 1. let reversedComposedPath be an empty list
> 1. let hiddenSubtreeLevel be 0
> 1. let hasSeenCurrentTarget be false
> 1. reverse iterate path (from Window to the target of the event):
>    1. if tuple's item is currentTarget, set hasSeenCurrentTarget to true
>    1. else if hasSeenCurrentTarget is true and tuple's item has root-of-closed-tree flag, increase hiddenSubtreeLevel by 1.
>    1. if hiddenSubtreeLevel is 0, append tuple's item to reversedComposedPath.
>    1. if tuple's item has slot-in-closed-tree, decrease hiddenSubtreeLevel by 1.
> 1. return reverse(reversedComposedPath)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/525#issuecomment-342179455

Received on Monday, 6 November 2017 15:17:07 UTC