Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (3) Spec relatedTarget for focus and blur
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=25279
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@8621 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 8, 2014
1 parent 1106881 commit 90f4d9c
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 14 deletions.
35 changes: 30 additions & 5 deletions complete.html
Expand Up @@ -3786,6 +3786,8 @@ <h4 id=dependencies><span class=secno>2.2.2 </span>Dependencies</h4>
<ul class=brief><li><dfn id=mouseevent><code>MouseEvent</code></dfn> interface</li>
<li><dfn id=mouseeventinit><code>MouseEventInit</code></dfn> dictionary type</li>

<li>The <dfn id=focusevent><code>FocusEvent</code></dfn> interface and its <dfn id=dom-focusevent-relatedtarget title=dom-FocusEvent-relatedTarget><code>relatedTarget</code></dfn> attribute</li>

<li>The <dfn id=uievent><code>UIEvent</code></dfn> interface's <dfn id=dom-uievent-detail title=dom-UIEvent-detail><code>detail</code></dfn> attribute</li>

<li><dfn id=event-click title=event-click><code>click</code></dfn> event</li>
Expand Down Expand Up @@ -77444,10 +77446,17 @@ <h4 id=processing-model-6><span class=secno>8.4.4 </span>Processing model</h4>

</li>

<li><p>If <var title="">entry</var> is the last entry in <var title="">old chain</var>, and
<var title="">entry</var> is an <code><a href=#element>Element</a></code>, and the last entry in <var title="">new
chain</var> is also an <code><a href=#element>Element</a></code>, then let <var title="">related blur target</var>
be the last entry in <var title="">new chain</var>. Otherwise, let <var title="">related blur
target</var> be null.</li>

<li>

<p>If <var title="">blur event target</var> is not null, <a href=#fire-a-simple-event>fire a simple event</a>
named <code title=event-blur><a href=#event-blur>blur</a></code> at <var title="">blur event target</var>.</p>
<p>If <var title="">blur event target</var> is not null, <a href=#fire-a-focus-event>fire a focus event</a>
named <code title=event-blur><a href=#event-blur>blur</a></code> at <var title="">blur event target</var>, with
<var title="">related blur target</var> as the related target.</p>

<p class=note>In some cases, e.g. if <var title="">entry</var> is an <code><a href=#the-area-element>area</a></code>
element's shape, a scrollable region, or a viewport, no event is fired.</p>
Expand Down Expand Up @@ -77493,10 +77502,17 @@ <h4 id=processing-model-6><span class=secno>8.4.4 </span>Processing model</h4>

</li>

<li><p>If <var title="">entry</var> is the last entry in <var title="">new chain</var>, and
<var title="">entry</var> is an <code><a href=#element>Element</a></code>, and the last entry in <var title="">old
chain</var> is also an <code><a href=#element>Element</a></code>, then let <var title="">related focus target</var>
be the last entry in <var title="">old chain</var>. Otherwise, let <var title="">related
focus target</var> be null.</li>

<li>

<p>If <var title="">focus event target</var> is not null, <a href=#fire-a-simple-event>fire a simple event</a>
named <code title=event-focus><a href=#event-focus>focus</a></code> at <var title="">focus event target</var>.</p>
<p>If <var title="">focus event target</var> is not null, <a href=#fire-a-focus-event>fire a focus event</a>
named <code title=event-focus><a href=#event-focus>focus</a></code> at <var title="">focus event target</var>, with
<var title="">related focus target</var> as the related target.</p>

<p class=note>In some cases, e.g. if <var title="">entry</var> is an <code><a href=#the-area-element>area</a></code>
element's shape, a scrollable region, or a viewport, no event is fired.</p>
Expand All @@ -77505,7 +77521,15 @@ <h4 id=processing-model-6><span class=secno>8.4.4 </span>Processing model</h4>

</ol></li>

</ol><hr><p>When a key event is to be routed in a <a href=#top-level-browsing-context>top-level browsing context</a>, the user agent
</ol><p>When a user agent is required to <dfn id=fire-a-focus-event>fire a focus event</dfn> named <var title="">e</var> at
an element <var title="">t</var> and with a given related target <var title="">r</var>, the user
agent must create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code><a href=#focusevent>FocusEvent</a></code>
object, initialize it to have the given name <var title="">e</var>, to not bubble, to not be
cancelable, and to have the <code title=dom-FocusEvent-relatedTarget><a href=#dom-focusevent-relatedtarget>relatedTarget</a></code>
attribute initialized to <var title="">r</var>, and must then <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> the newly created <code><a href=#focusevent>FocusEvent</a></code> object
at the specified target element <var title="">t</var>.</p>

<hr><p>When a key event is to be routed in a <a href=#top-level-browsing-context>top-level browsing context</a>, the user agent
must run the following steps:</p>

<ol><li><p>Let <var title="">target area</var> be the <a href=#currently-focused-area-of-a-top-level-browsing-context title="currently focused area of a
Expand Down Expand Up @@ -104564,6 +104588,7 @@ <h2 class=no-num id=references>References</h2><!--REFS-->
Anthony Hickson,
Anthony Ricaud,
Antti Koivisto,
Arkadiusz Michalski,
Arne Thomassen,
Aron Spohr,
Arphen Lin,
Expand Down
35 changes: 30 additions & 5 deletions index
Expand Up @@ -3786,6 +3786,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<ul class=brief><li><dfn id=mouseevent><code>MouseEvent</code></dfn> interface</li>
<li><dfn id=mouseeventinit><code>MouseEventInit</code></dfn> dictionary type</li>

<li>The <dfn id=focusevent><code>FocusEvent</code></dfn> interface and its <dfn id=dom-focusevent-relatedtarget title=dom-FocusEvent-relatedTarget><code>relatedTarget</code></dfn> attribute</li>

<li>The <dfn id=uievent><code>UIEvent</code></dfn> interface's <dfn id=dom-uievent-detail title=dom-UIEvent-detail><code>detail</code></dfn> attribute</li>

<li><dfn id=event-click title=event-click><code>click</code></dfn> event</li>
Expand Down Expand Up @@ -77444,10 +77446,17 @@ loadMySprites().then(runDemo);</pre>

</li>

<li><p>If <var title="">entry</var> is the last entry in <var title="">old chain</var>, and
<var title="">entry</var> is an <code><a href=#element>Element</a></code>, and the last entry in <var title="">new
chain</var> is also an <code><a href=#element>Element</a></code>, then let <var title="">related blur target</var>
be the last entry in <var title="">new chain</var>. Otherwise, let <var title="">related blur
target</var> be null.</li>

<li>

<p>If <var title="">blur event target</var> is not null, <a href=#fire-a-simple-event>fire a simple event</a>
named <code title=event-blur><a href=#event-blur>blur</a></code> at <var title="">blur event target</var>.</p>
<p>If <var title="">blur event target</var> is not null, <a href=#fire-a-focus-event>fire a focus event</a>
named <code title=event-blur><a href=#event-blur>blur</a></code> at <var title="">blur event target</var>, with
<var title="">related blur target</var> as the related target.</p>

<p class=note>In some cases, e.g. if <var title="">entry</var> is an <code><a href=#the-area-element>area</a></code>
element's shape, a scrollable region, or a viewport, no event is fired.</p>
Expand Down Expand Up @@ -77493,10 +77502,17 @@ loadMySprites().then(runDemo);</pre>

</li>

<li><p>If <var title="">entry</var> is the last entry in <var title="">new chain</var>, and
<var title="">entry</var> is an <code><a href=#element>Element</a></code>, and the last entry in <var title="">old
chain</var> is also an <code><a href=#element>Element</a></code>, then let <var title="">related focus target</var>
be the last entry in <var title="">old chain</var>. Otherwise, let <var title="">related
focus target</var> be null.</li>

<li>

<p>If <var title="">focus event target</var> is not null, <a href=#fire-a-simple-event>fire a simple event</a>
named <code title=event-focus><a href=#event-focus>focus</a></code> at <var title="">focus event target</var>.</p>
<p>If <var title="">focus event target</var> is not null, <a href=#fire-a-focus-event>fire a focus event</a>
named <code title=event-focus><a href=#event-focus>focus</a></code> at <var title="">focus event target</var>, with
<var title="">related focus target</var> as the related target.</p>

<p class=note>In some cases, e.g. if <var title="">entry</var> is an <code><a href=#the-area-element>area</a></code>
element's shape, a scrollable region, or a viewport, no event is fired.</p>
Expand All @@ -77505,7 +77521,15 @@ loadMySprites().then(runDemo);</pre>

</ol></li>

</ol><hr><p>When a key event is to be routed in a <a href=#top-level-browsing-context>top-level browsing context</a>, the user agent
</ol><p>When a user agent is required to <dfn id=fire-a-focus-event>fire a focus event</dfn> named <var title="">e</var> at
an element <var title="">t</var> and with a given related target <var title="">r</var>, the user
agent must create a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code><a href=#focusevent>FocusEvent</a></code>
object, initialize it to have the given name <var title="">e</var>, to not bubble, to not be
cancelable, and to have the <code title=dom-FocusEvent-relatedTarget><a href=#dom-focusevent-relatedtarget>relatedTarget</a></code>
attribute initialized to <var title="">r</var>, and must then <a href=#concept-event-dispatch title=concept-event-dispatch>dispatch</a> the newly created <code><a href=#focusevent>FocusEvent</a></code> object
at the specified target element <var title="">t</var>.</p>

<hr><p>When a key event is to be routed in a <a href=#top-level-browsing-context>top-level browsing context</a>, the user agent
must run the following steps:</p>

<ol><li><p>Let <var title="">target area</var> be the <a href=#currently-focused-area-of-a-top-level-browsing-context title="currently focused area of a
Expand Down Expand Up @@ -104564,6 +104588,7 @@ if (s = prompt('What is your name?')) {
Anthony Hickson,
Anthony Ricaud,
Antti Koivisto,
Arkadiusz Michalski,
Arne Thomassen,
Aron Spohr,
Arphen Lin,
Expand Down
34 changes: 30 additions & 4 deletions source
Expand Up @@ -2524,6 +2524,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li><dfn><code>MouseEvent</code></dfn> interface</li>
<li><dfn><code>MouseEventInit</code></dfn> dictionary type</li>

<li>The <dfn><code>FocusEvent</code></dfn> interface and its <dfn data-x="dom-FocusEvent-relatedTarget"><code>relatedTarget</code></dfn> attribute</li>

<li>The <dfn><code>UIEvent</code></dfn> interface's <dfn data-x="dom-UIEvent-detail"><code>detail</code></dfn> attribute</li>

<li><dfn data-x="event-click"><code>click</code></dfn> event</li>
Expand Down Expand Up @@ -85556,10 +85558,17 @@ loadMySprites().then(runDemo);</pre>

</li>

<li><p>If <var data-x="">entry</var> is the last entry in <var data-x="">old chain</var>, and
<var data-x="">entry</var> is an <code>Element</code>, and the last entry in <var data-x="">new
chain</var> is also an <code>Element</code>, then let <var data-x="">related blur target</var>
be the last entry in <var data-x="">new chain</var>. Otherwise, let <var data-x="">related blur
target</var> be null.</p></li>

<li>

<p>If <var data-x="">blur event target</var> is not null, <span>fire a simple event</span>
named <code data-x="event-blur">blur</code> at <var data-x="">blur event target</var>.</p>
<p>If <var data-x="">blur event target</var> is not null, <span>fire a focus event</span>
named <code data-x="event-blur">blur</code> at <var data-x="">blur event target</var>, with
<var data-x="">related blur target</var> as the related target.</p>

<p class="note">In some cases, e.g. if <var data-x="">entry</var> is an <code>area</code>
element's shape, a scrollable region, or a viewport, no event is fired.</p>
Expand Down Expand Up @@ -85611,10 +85620,17 @@ loadMySprites().then(runDemo);</pre>

</li>

<li><p>If <var data-x="">entry</var> is the last entry in <var data-x="">new chain</var>, and
<var data-x="">entry</var> is an <code>Element</code>, and the last entry in <var data-x="">old
chain</var> is also an <code>Element</code>, then let <var data-x="">related focus target</var>
be the last entry in <var data-x="">old chain</var>. Otherwise, let <var data-x="">related
focus target</var> be null.</p></li>

<li>

<p>If <var data-x="">focus event target</var> is not null, <span>fire a simple event</span>
named <code data-x="event-focus">focus</code> at <var data-x="">focus event target</var>.</p>
<p>If <var data-x="">focus event target</var> is not null, <span>fire a focus event</span>
named <code data-x="event-focus">focus</code> at <var data-x="">focus event target</var>, with
<var data-x="">related focus target</var> as the related target.</p>

<p class="note">In some cases, e.g. if <var data-x="">entry</var> is an <code>area</code>
element's shape, a scrollable region, or a viewport, no event is fired.</p>
Expand All @@ -85627,6 +85643,15 @@ loadMySprites().then(runDemo);</pre>

</ol>

<p>When a user agent is required to <dfn>fire a focus event</dfn> named <var data-x="">e</var> at
an element <var data-x="">t</var> and with a given related target <var data-x="">r</var>, the user
agent must create a <span data-x="concept-events-trusted">trusted</span> <code>FocusEvent</code>
object, initialize it to have the given name <var data-x="">e</var>, to not bubble, to not be
cancelable, and to have the <code data-x="dom-FocusEvent-relatedTarget">relatedTarget</code>
attribute initialized to <var data-x="">r</var>, and must then <span
data-x="concept-event-dispatch">dispatch</span> the newly created <code>FocusEvent</code> object
at the specified target element <var data-x="">t</var>.</p>

<hr>

<p>When a key event is to be routed in a <span>top-level browsing context</span>, the user agent
Expand Down Expand Up @@ -115701,6 +115726,7 @@ if (s = prompt('What is your name?')) {
Anthony Hickson,
Anthony Ricaud,
Antti Koivisto,
Arkadiusz Michalski,
Arne Thomassen,
Aron Spohr,
Arphen Lin,
Expand Down

0 comments on commit 90f4d9c

Please sign in to comment.