Re: [whatwg/dom] Correct setting of target and relatedTargets post-dispatch (#585)

hayatoito commented on this pull request.



> @@ -5751,9 +5757,21 @@ is an object or one of its <a>shadow-including ancestors</a>.
 <var>B</var>, repeat these steps until they return an object:</p>
 
 <ol>
- <li><p>If <var>A</var>'s <a for=tree>root</a> is not a <a for=/>shadow root</a>, or <var>A</var>'s
- <a for=tree>root</a> is a <a>shadow-including inclusive ancestor</a> of <var>B</var>, then return
- <var>A</var>.
+ <li><p>If <var>A</var> is a {{Window}} object, then set <var>A</var> to <var>A</var>'s
+ <a>associated <code>Document</code></a>.

I think removing this step is not enough. 
e.g. If A is a node in a shadow tree and B is a Window, we should loop until A reaches the outer most shadow host.

The following should work, I think.

1. If one of the following is true

   - A is not a node
   - A’s root is not a shadow root
   - B is a node and A’s root is a shadow-including inclusive ancestor of B

   then return A.

2. Set A to A’s root’s host.


-- 
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/pull/585#discussion_r174028932

Received on Tuesday, 13 March 2018 06:46:02 UTC