Re: [whatwg/dom] Add reference target to shadow root (PR #1353)

@annevk commented on this pull request.



> -<a for=Event/path>invocation target</a>; otherwise <a for=/>shadow root</a>'s
-<a for=DocumentFragment>host</a>.
+the result of the following steps:</p>
+
+<ol>
+ <li><p>If <var>event</var>’s <a>composed flag</a> is set, return <a for=/>shadow root</a>’s
+ <a for=DocumentFragment>host</a>.</p></li>
+ <li><p>Let <var>target</var> be <var>event</var>’s <a for=Event>path</a>'s first struct's
+ <a for=Event/path>invocation target</a>.</p></li>
+ <li><p>Let <var>source</var> be <var>event</var>'s <a for=Event>source</a>.</p></li>
+ <li><p>If <a for=/>shadow root</a> is not the <a for=tree>root</a> of <var>target</var>, and either
+ <var>source</var> is null or <a for=/>shadow root</a> is not the <a for=tree>root</a> of
+ <var>source</var>, return <a for=/>shadow root</a>'s <a for=DocumentFragment>host</a>.</p></li>
+ <li><p>If <var>source</var> is not null, and <var>source</var>'s <a for=tree>root</a> is a
+ <a>shadow-including ancestor</a> of <a for=/>shadow root</a>, return the result of
+ <a>retargeting</a> <var>target</var> against <var>source</var>.</p></li>

I wonder if we should add one or two examples here because this is getting rather involved. It seems really weird that as part of calculating the dispatch tree we are retargeting.

Also just to return the event target as the parent of the shadow tree. I can't really wrap my head around this.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1353#pullrequestreview-4329756834
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1353/review/4329756834@github.com>

Received on Wednesday, 20 May 2026 15:12:12 UTC