Re: [whatwg/dom] Allow for customisation of the "get the parent" algorithm (PR #1230)

@smaug---- requested changes on this pull request.



> @@ -1322,6 +1373,9 @@ property of the event being dispatched.
     <p>While <var>parent</var> is non-null:</p>
 
     <ol>
+     <li>If the <var>event</var>'s <a for=Event>path</a> <a for=set>contains</a> <var>parent</var>
+     then <a>throw</a> a "{{HierarchyRequestError!!exception}}" {{DOMException}}.
+

This would be slow. I don't think we can do this in normal case when dispatching events to dom tree. The relevant code in implementations is so hot that extra virtual c++ calls show up, as an example.
We need to ensure that there are now loops when setting up the parents. That is already done for DOM nodes anyhow - DOM tree doesn't contain loops.

> @@ -908,9 +908,14 @@ for historical reasons.
 <h3 id=interface-eventtarget>Interface {{EventTarget}}</h3>
 
 <pre class=idl>
+[Exposed=*]
+interface EventTargetInternals {
+  attribute EventTarget parent;
+};
+

This feels a bit cumbersome API, one needs to pass a callback and then use its param to change a property value.

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

Message ID: <whatwg/dom/pull/1230/review/1670619969@github.com>

Received on Wednesday, 11 October 2023 09:42:11 UTC