Skip to content

Commit

Permalink
Shadow: add "retargeting steps" to the dispatch algorithm
Browse files Browse the repository at this point in the history
Add a "retargeting steps" hook to the dispatch algorithm so other specifications can adjust an event's internal slots before the event listeners of event's path are invoked.

This hook will be used in Touch Events. Fixes #286.
  • Loading branch information
hayatoito authored and annevk committed Aug 4, 2016
1 parent ef69a24 commit fbc0c31
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,11 @@ list of tuples, each of which consists of an <b>item</b> (an {{EventTarget}} obj
object). A tuple is formatted as (<b>item</b>, <b>target</b>, <b>relatedTarget</b>). A <a
for=Event>path</a> is initially the empty list.</p>

<p><a lt="Other applicable specifications">Specifications</a> may define
<dfn export for=Event>retargeting steps</dfn> for all or some <a>events</a>.
The algorithm is passed <var>event</var>, as indicated in the <a>dispatch</a>
algorithm below.

<dl class=domintro>
<dt><code><var>event</var> = new <a constructor lt="Event()">Event</a>(<var>type</var> [, <var>eventInitDict</var>])</code>
<dd>Returns a new <var>event</var> whose
Expand Down Expand Up @@ -1236,6 +1241,8 @@ for discussion).

<li><p>Set <var>event</var>'s <a>relatedTarget</a> to <var>tuple</var>'s <b>relatedTarget</b>.

<li><p>Run the <a>retargeting steps</a> with <var>event</var>.

<li><p>If <var>tuple</var>'s <b>target</b> is null, then <a>invoke</a> <var>tuple</var>'s
<b>item</b> with <var>event</var>.
</ol>
Expand All @@ -1250,6 +1257,8 @@ for discussion).

<li><p>Set <var>event</var>'s <a>relatedTarget</a> to <var>tuple</var>'s <b>relatedTarget</b>.

<li><p>Run the <a>retargeting steps</a> with <var>event</var>.

<li><p>If <var>tuple</var>'s <b>target</b> is non-null, then set <var>event</var>'s
{{Event/eventPhase}} attribute to {{Event/AT_TARGET}}.

Expand Down
9 changes: 8 additions & 1 deletion dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" height="100" src="https://resources.whatwg.org/logo-dom.svg"> </a> </p>
<hgroup>
<h1 class="p-name no-ref allcaps" id="title">DOM</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2016-07-22">22 July 2016</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2016-08-04">4 August 2016</time></span></h2>
</hgroup>
<div data-fill-with="spec-metadata">
<dl>
Expand Down Expand Up @@ -525,6 +525,8 @@ <h3 class="heading settled" data-level="3.2" id="interface-event"><span class="s
<p class="note" role="note">Other specifications use <a data-link-type="dfn" href="#event-relatedtarget">relatedTarget</a> to define a <code>relatedTarget</code> attribute. <a data-link-type="biblio" href="#biblio-uievents">[UIEVENTS]</a> </p>
<p>An <a data-link-type="dfn" href="#concept-event">event</a> has an associated <dfn data-dfn-for="Event" data-dfn-type="dfn" data-export="" id="event-path">path<a class="self-link" href="#event-path"></a></dfn>. A <a data-link-type="dfn" href="#event-path">path</a> is a
list of tuples, each of which consists of an <b>item</b> (an <code class="idl"><a data-link-type="idl" href="#eventtarget">EventTarget</a></code> object), <b>target</b> (null or an <code class="idl"><a data-link-type="idl" href="#eventtarget">EventTarget</a></code> object), and a <b>relatedTarget</b> (null or an <code class="idl"><a data-link-type="idl" href="#eventtarget">EventTarget</a></code> object). A tuple is formatted as (<b>item</b>, <b>target</b>, <b>relatedTarget</b>). A <a data-link-type="dfn" href="#event-path">path</a> is initially the empty list.</p>
<p><a data-link-type="dfn" href="#other-applicable-specifications">Specifications</a> may define <dfn data-dfn-for="Event" data-dfn-type="dfn" data-export="" id="event-retargeting-steps">retargeting steps<a class="self-link" href="#event-retargeting-steps"></a></dfn> for all or some <a data-link-type="dfn" href="#concept-event">events</a>.
The algorithm is passed <var>event</var>, as indicated in the <a data-link-type="dfn" href="#concept-event-dispatch">dispatch</a> algorithm below. </p>
<dl class="domintro">
<dt><code><var>event</var> = new <a class="idl-code" data-link-type="constructor" href="#dom-event-event">Event</a>(<var>type</var> [, <var>eventInitDict</var>])</code>
<dd>Returns a new <var>event</var> whose <code class="idl"><a data-link-type="idl" href="#dom-event-type">type</a></code> attribute value is set to <var>type</var>. The optional <var>eventInitDict</var> argument
Expand Down Expand Up @@ -903,6 +905,8 @@ <h3 class="heading settled" data-level="3.8" id="dispatching-events"><span class
in <var>event</var>’s <a data-link-type="dfn" href="#event-path">path</a>, that is either <var>tuple</var> or preceding <var>tuple</var>, whose <b>target</b> is non-null. </p>
<li>
<p>Set <var>event</var>’s <a data-link-type="dfn" href="#event-relatedtarget">relatedTarget</a> to <var>tuple</var>’s <b>relatedTarget</b>. </p>
<li>
<p>Run the <a data-link-type="dfn" href="#event-retargeting-steps">retargeting steps</a> with <var>event</var>. </p>
<li>
<p>If <var>tuple</var>’s <b>target</b> is null, then <a data-link-type="dfn" href="#concept-event-listener-invoke">invoke</a> <var>tuple</var>’s <b>item</b> with <var>event</var>. </p>
</ol>
Expand All @@ -914,6 +918,8 @@ <h3 class="heading settled" data-level="3.8" id="dispatching-events"><span class
in <var>event</var>’s <a data-link-type="dfn" href="#event-path">path</a>, that is either <var>tuple</var> or preceding <var>tuple</var>, whose <b>target</b> is non-null. </p>
<li>
<p>Set <var>event</var>’s <a data-link-type="dfn" href="#event-relatedtarget">relatedTarget</a> to <var>tuple</var>’s <b>relatedTarget</b>. </p>
<li>
<p>Run the <a data-link-type="dfn" href="#event-retargeting-steps">retargeting steps</a> with <var>event</var>. </p>
<li>
<p>If <var>tuple</var>’s <b>target</b> is non-null, then set <var>event</var>’s <code class="idl"><a data-link-type="idl" href="#dom-event-eventphase">eventPhase</a></code> attribute to <code class="idl"><a data-link-type="idl" href="#dom-event-at_target">AT_TARGET</a></code>. </p>
<li>
Expand Down Expand Up @@ -6116,6 +6122,7 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<li><a href="#represented-by-the-collection">represented by the collection</a><span>, in §4.2.10</span>
<li><a href="#retarget">retarget</a><span>, in §4.8</span>
<li><a href="#retarget">retargeting</a><span>, in §4.8</span>
<li><a href="#event-retargeting-steps">retargeting steps</a><span>, in §3.2</span>
<li>
root
<ul>
Expand Down

0 comments on commit fbc0c31

Please sign in to comment.