diff --git a/dom.bs b/dom.bs index b4c0abd3..f393b95d 100644 --- a/dom.bs +++ b/dom.bs @@ -908,9 +908,14 @@ for historical reasons.

Interface {{EventTarget}}

+[Exposed=*]
+interface EventTargetInternals {
+  attribute EventTarget parent;
+}
+
 [Exposed=*]
 interface EventTarget {
-  constructor();
+  constructor(optional EventTargetCallback cb);
 
   undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
   undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
@@ -930,6 +935,8 @@ dictionary AddEventListenerOptions : EventListenerOptions {
   boolean once = false;
   AbortSignal signal;
 };
+
+callback EventTargetCallback = undefined (EventTargetInternals internals);
 

An {{EventTarget}} object represents a target to which an event can be dispatched @@ -939,6 +946,26 @@ when something has occurred. list of zero or more event listeners). It is initially the empty list. +

Each {{EventTarget}} object has an associated attached internals (null +or an {{EventTargetInternals}} object), initially null. + +

The new EventTarget(cb) constructor steps are: + +

    +
  1. If cb is not null then: + +

      +
    1. Let eventTargetInternals a new {{EventTargetInternals}} instance. + +

    2. invoke cb with « + eventTargetInternals » and with eventTarget as the callback this + value. + +
    3. Set this's {{Eventtarget/attached internals}} to + eventTargetInternals. +

    +
+

An event listener can be used to observe a specific event and consists of: @@ -956,8 +983,9 @@ when something has occurred. object, an event listener is a broader concept as can be seen above.

Each {{EventTarget}} object also has an associated get the parent algorithm, -which takes an event event, and returns an {{EventTarget}} object. Unless -specified otherwise it returns null. +which takes an event event, and returns an {{EventTarget}}. Unless otherwise +specified otherwise it returns the associated attached internalsparent attribute.

Nodes, shadow roots, and documents override the get the parent algorithm. @@ -1322,6 +1350,9 @@ property of the event being dispatched.

While parent is non-null:

    +
  1. If the event's path contains parent then throw a + "{{HierarchyRequestError!!exception}}" {{DOMException}}. +
  2. If slottable is non-null: