- From: Anne van Kesteren <notifications@github.com>
- Date: Wed, 11 Oct 2023 00:09:29 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1230/review/1670185746@github.com>
@annevk commented on this pull request. Some initial feedback. Mainly around how to organize this. Overall I think this works, but would love to hear from @rniwa and @smaug---- especially. > +[Exposed=*] +interface EventTargetInternals { + attribute EventTarget parent; +} + +callback EventTargetCallback = undefined (EventTargetInternals internals); Nit: let's put this at the end. > @@ -939,6 +946,34 @@ when something has occurred. <a for=/>list</a> of zero or more <a>event listeners</a>). It is initially the empty list. <!-- Intentionally not exported. --> +<p>Each {{EventTarget}} object has an associated <dfn for=EventTarget>attached internals</dfn> (null +or an {{EventTargetInternals}} object), initially null. +<!-- Intentionally not exported. --> No need for this comment, but I agree! > +<p>When a <dfn export for=Event id=concept-eventtarget-constructor>constructor</dfn> of the {{EventTarget}} +interface, or of an interface that inherits from the {{EventTarget}} interface, is invoked, these steps +must be run, given the arguments <var>eventTargetCallback</var>: You need to write this similar to https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller. So something like: > The new EventTarget(callback) constructor steps are: The argument name should match the argument name used in IDL. > @@ -939,6 +946,34 @@ when something has occurred. <a for=/>list</a> of zero or more <a>event listeners</a>). It is initially the empty list. <!-- Intentionally not exported. --> +<p>Each {{EventTarget}} object has an associated <dfn for=EventTarget>attached internals</dfn> (null +or an {{EventTargetInternals}} object), initially null. +<!-- Intentionally not exported. --> + +<p>When a <dfn export for=Event id=concept-eventtarget-constructor>constructor</dfn> of the {{EventTarget}} +interface, or of an interface that inherits from the {{EventTarget}} interface, is invoked, these steps +must be run, given the arguments <var>eventTargetCallback</var>: + +<ol> + <li><p>Let <var>eventTarget</var> be the result of creating a new object using this interface. With the new-style constructor steps, creation already happened. You just need to manipulate "this". > + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/event listener list}} attribute to the empty list. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/parent}} attribute to null. Aren't these the defaults already? > +<p>Each {{EventTarget}} object has an associated <dfn for=EventTarget>attached internals</dfn> (null +or an {{EventTargetInternals}} object), initially null. +<!-- Intentionally not exported. --> + +<p>When a <dfn export for=Event id=concept-eventtarget-constructor>constructor</dfn> of the {{EventTarget}} +interface, or of an interface that inherits from the {{EventTarget}} interface, is invoked, these steps +must be run, given the arguments <var>eventTargetCallback</var>: + +<ol> + <li><p>Let <var>eventTarget</var> be the result of creating a new object using this interface. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/event listener list}} attribute to the empty list. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/parent}} attribute to null. + + <li><p>Let <var>eventTargetInternals</var> a new {{EventTargetInternals}} instance. Only create this when the callback is given. > +<p>When a <dfn export for=Event id=concept-eventtarget-constructor>constructor</dfn> of the {{EventTarget}} +interface, or of an interface that inherits from the {{EventTarget}} interface, is invoked, these steps +must be run, given the arguments <var>eventTargetCallback</var>: + +<ol> + <li><p>Let <var>eventTarget</var> be the result of creating a new object using this interface. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/event listener list}} attribute to the empty list. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/parent}} attribute to null. + + <li><p>Let <var>eventTargetInternals</var> a new {{EventTargetInternals}} instance. + + <li><p>If <var>eventTargetCallback</var> is not null, then <a + for=/invoke-a-callback-function>invoke</a> <var>eventTargetCallback</var> with « + <var>eventTargetInternals</var> » and with <var>eventTarget</var> aas the <a>callback this as* > + +<ol> + <li><p>Let <var>eventTarget</var> be the result of creating a new object using this interface. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/event listener list}} attribute to the empty list. + + <li><p>Initialize <var>eventTarget</var>'s {{EventTarget/parent}} attribute to null. + + <li><p>Let <var>eventTargetInternals</var> a new {{EventTargetInternals}} instance. + + <li><p>If <var>eventTargetCallback</var> is not null, then <a + for=/invoke-a-callback-function>invoke</a> <var>eventTargetCallback</var> with « + <var>eventTargetInternals</var> » and with <var>eventTarget</var> aas the <a>callback this + value</a>. + + <li><p>Set <var>eventTarget</var>'s {{Eventtarget/attached internals}} attribute to s/attribute// > <p>Each {{EventTarget}} object also has an associated <dfn export>get the parent</dfn> algorithm, -which takes an <a>event</a> <var>event</var>, and returns an {{EventTarget}} object. Unless -specified otherwise it returns null. +which takes an <a>event</a> <var>event</var>, and returns an {{EventTarget}}. Unless otherwise +specified otherwise it returns the associated <a for=EventTarget>attached internals</a><a +for=EventTargetInternals">parent</a> attribute. I think instead we should make the `parent` setter overwrite this algorithm with an algorithm that returns the given value. > @@ -1296,6 +1332,8 @@ property of the event being dispatched. <ol> <li><p>Let <var>touchTargets</var> be a new <a for=/>list</a>. + <li><p>Let <var>parentTargets</var> be a new <a for=/>list</a>. Can't we inspect event's path instead? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/1230#pullrequestreview-1670185746 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/pull/1230/review/1670185746@github.com>
Received on Wednesday, 11 October 2023 07:09:35 UTC