@@ -908,9 +908,14 @@ for historical reasons.
908
908
<h3 id=interface-eventtarget>Interface {{EventTarget}}</h3>
909
909
910
910
<pre class=idl>
911
+ [Exposed=*]
912
+ interface EventTargetInternals {
913
+ attribute EventTarget parent;
914
+ }
915
+
911
916
[Exposed=*]
912
917
interface EventTarget {
913
- constructor();
918
+ constructor(optional EventTargetCallback cb );
914
919
915
920
undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
916
921
undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
@@ -930,6 +935,8 @@ dictionary AddEventListenerOptions : EventListenerOptions {
930
935
boolean once = false;
931
936
AbortSignal signal;
932
937
};
938
+
939
+ callback EventTargetCallback = undefined (EventTargetInternals internals);
933
940
</pre>
934
941
935
942
<p> An {{EventTarget}} object represents a target to which an <a>event</a> can be <a>dispatched</a>
@@ -939,6 +946,26 @@ when something has occurred.
939
946
<a for=/>list</a> of zero or more <a>event listeners</a> ). It is initially the empty list.
940
947
<!-- Intentionally not exported. -->
941
948
949
+ <p> Each {{EventTarget}} object has an associated <dfn for=EventTarget>attached internals</dfn> (null
950
+ or an {{EventTargetInternals}} object), initially null.
951
+
952
+ <p> The <dfn export for=Event id=concept-eventtarget-constructor>new EventTarget(cb)</dfn> constructor steps are:
953
+
954
+ <ol>
955
+ <li><p> If <var> cb</var> is not null then:
956
+
957
+ <ol>
958
+ <li><p> Let <var> eventTargetInternals</var> a new {{EventTargetInternals}} instance.
959
+
960
+ <li> <a for=/invoke-a-callback-function>invoke</a> <var> cb</var> with «
961
+ <var> eventTargetInternals</var> » and with <var> eventTarget</var> as the <a>callback this
962
+ value</a> .
963
+
964
+ <li><p> Set <var> this</var> 's {{Eventtarget/attached internals}} to
965
+ <var> eventTargetInternals</var> .
966
+ </ol>
967
+ </ol>
968
+
942
969
<p> An <dfn export id=concept-event-listener>event listener</dfn> can be used to observe a specific
943
970
<a>event</a> and consists of:
944
971
@@ -956,8 +983,9 @@ when something has occurred.
956
983
object, an <a>event listener</a> is a broader concept as can be seen above.
957
984
958
985
<p> Each {{EventTarget}} object also has an associated <dfn export>get the parent</dfn> algorithm,
959
- which takes an <a>event</a> <var> event</var> , and returns an {{EventTarget}} object. Unless
960
- specified otherwise it returns null.
986
+ which takes an <a>event</a> <var> event</var> , and returns an {{EventTarget}} . Unless otherwise
987
+ specified otherwise it returns the associated <a for=EventTarget>attached internals</a> <a
988
+ for=EventTargetInternals"> parent</a> attribute.
961
989
962
990
<p class=note> <a for=/>Nodes</a> , <a for=/>shadow roots</a> , and <a>documents</a>
963
991
override the <a>get the parent</a> algorithm.
@@ -1322,6 +1350,9 @@ property of the event being dispatched.
1322
1350
<p> While <var> parent</var> is non-null:</p>
1323
1351
1324
1352
<ol>
1353
+ <li> If the <var> event</var> 's <a for=Event>path</a> <a for=/>contains</a> <var> parent</var> then <a>throw</a> a
1354
+ "{{HierarchyRequestError!!exception}} " {{DOMException}} .
1355
+
1325
1356
<li>
1326
1357
<p> If <var> slottable</var> is non-null:
1327
1358
0 commit comments