@@ -908,9 +908,16 @@ 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
+
916
+ callback EventTargetCallback = undefined (EventTargetInternals internals);
917
+
911
918
[Exposed=*]
912
919
interface EventTarget {
913
- constructor();
920
+ constructor(optional EventTargetCallback cb );
914
921
915
922
undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
916
923
undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
@@ -939,6 +946,34 @@ 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
+ <!-- Intentionally not exported. -->
952
+
953
+ <p> When a <dfn export for=Event id=concept-eventtarget-constructor>constructor</dfn> of the {{EventTarget}}
954
+ interface, or of an interface that inherits from the {{EventTarget}} interface, is invoked, these steps
955
+ must be run, given the arguments <var> eventTargetCallback</var> :
956
+
957
+ <ol>
958
+ <li><p> Let <var> eventTarget</var> be the result of creating a new object using this interface.
959
+
960
+ <li><p> Initialize <var> eventTarget</var> 's {{EventTarget/event listener list}} attribute to the empty list.
961
+
962
+ <li><p> Initialize <var> eventTarget</var> 's {{EventTarget/parent}} attribute to null.
963
+
964
+ <li><p> Let <var> eventTargetInternals</var> a new {{EventTargetInternals}} instance.
965
+
966
+ <li><p> If <var> eventTargetCallback</var> is not null, then <a
967
+ for=/invoke-a-callback-function> invoke</a> <var> eventTargetCallback</var> with «
968
+ <var> eventTargetInternals</var> » and with <var> eventTarget</var> aas the <a>callback this
969
+ value</a> .
970
+
971
+ <li><p> Set <var> eventTarget</var> 's {{Eventtarget/attached internals}} attribute to
972
+ <var> eventTargetInternals</var> .
973
+
974
+ <li><p> Return <var> eventTarget</var> .
975
+ </ol>
976
+
942
977
<p> An <dfn export id=concept-event-listener>event listener</dfn> can be used to observe a specific
943
978
<a>event</a> and consists of:
944
979
@@ -956,8 +991,9 @@ when something has occurred.
956
991
object, an <a>event listener</a> is a broader concept as can be seen above.
957
992
958
993
<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.
994
+ which takes an <a>event</a> <var> event</var> , and returns an {{EventTarget}} . Unless otherwise
995
+ specified otherwise it returns the associated <a for=EventTarget>attached internals</a> <a
996
+ for=EventTargetInternals"> parent</a> attribute.
961
997
962
998
<p class=note> <a for=/>Nodes</a> , <a for=/>shadow roots</a> , and <a>documents</a>
963
999
override the <a>get the parent</a> algorithm.
@@ -1296,6 +1332,8 @@ property of the event being dispatched.
1296
1332
<ol>
1297
1333
<li><p> Let <var> touchTargets</var> be a new <a for=/>list</a> .
1298
1334
1335
+ <li><p> Let <var> parentTargets</var> be a new <a for=/>list</a> .
1336
+
1299
1337
<li><p> <a for=list>For each</a> <var> touchTarget</var> of <var> event</var> 's
1300
1338
<a for=Event>touch target list</a> , <a for=list>append</a> the result of <a>retargeting</a>
1301
1339
<var> touchTarget</var> against <var> target</var> to <var> touchTargets</var> .
@@ -1322,6 +1360,11 @@ property of the event being dispatched.
1322
1360
<p> While <var> parent</var> is non-null:</p>
1323
1361
1324
1362
<ol>
1363
+ <li> If <var> parentTargets</var> <a for=/>contains</a> <var> parent</var> then <a>throw</a> a
1364
+ "{{HierarchyRequestError!!exception}} " {{DOMException}} .
1365
+
1366
+ <li> Append <var> parent</var> to <var> parentTargets</var> .
1367
+
1325
1368
<li>
1326
1369
<p> If <var> slottable</var> is non-null:
1327
1370
0 commit comments