Skip to content

Commit

Permalink
[giow] (1) Set the .relatedTarget attribute on 'click' events for <me…
Browse files Browse the repository at this point in the history
…nuitem> elements (and their master commands) properly.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=17840
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7792 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 3, 2013
1 parent f1a3b24 commit 700bd49
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
19 changes: 12 additions & 7 deletions complete.html
Expand Up @@ -50169,7 +50169,8 @@ <h4 id=the-button-element><span class=secno>4.10.8 </span>The <dfn><code>button<
modifier key information --></li>

<li><p>If the event is not canceled, then <a href=#construct-and-show-a-menu title="construct and show a menu">construct and
show</a> the menu for <var title="">menu</var>.</li>
show</a> the menu for <var title="">menu</var>, with the <code><a href=#the-button-element>button</a></code> element as the
subject.</li>

</ol></dd>

Expand Down Expand Up @@ -56063,7 +56064,7 @@ <h4 id=the-menu-element><span class=secno>4.11.3 </span>The <dfn id=menus><code>
<ul class=brief><li><a href=#concept-command title=concept-command>Commands</a>, which can be marked as default commands (<code><a href=#the-menuitem-element>menuitem</a></code>)</li>
<li>Separators (<code><a href=#the-hr-element>hr</a></code>)</li>
<li>Other menus, which allows the list to be nested (<code><a href=#the-menu-element>menu</a></code>)</li>
</ul><p>To <dfn id=construct-and-show-a-menu>construct and show a menu</dfn> for a particular <code><a href=#the-menu-element>menu</a></code> element, the user
</ul><!--CLEANUP--><p>To <dfn id=construct-and-show-a-menu>construct and show a menu</dfn> for a particular <code><a href=#the-menu-element>menu</a></code> element and with a particular element as a subject, the user
agent must run the following steps:</p>

<ol><li><p>Let the menu be an empty list of the type described above.</li>
Expand Down Expand Up @@ -56130,7 +56131,10 @@ <h4 id=the-menu-element><span class=secno>4.11.3 </span>The <dfn id=menus><code>
<p>Display the menu to the user, and let the algorithm that invoked this one continue.</p>

<p>If the user selects a menu item that corresponds to an element that still represents a <a href=#concept-command title=concept-command>command</a> when the user selects it, then the UA must invoke that
command's <a href=#command-facet-action title=command-facet-Action>Action</a>.</p>
command's <a href=#command-facet-action title=command-facet-Action>Action</a>. If the command's <a href=#command-facet-action title=command-facet-Action>Action</a> is defined as <a href=#fire-a-click-event title="fire a click event">firing
a <code title=event-click>click</code> event</a>, either directly or via the <a href=#run-synthetic-click-activation-steps>run
synthetic click activation steps</a> algorithm, then the <code title=dom-MouseEvent-relatedTarget>relatedTarget</code> attribute of that <code title=event-click><a href=#event-click>click</a></code> event must be initialized to the subject passed to this
<a href=#construct-and-show-a-menu>construct and show a menu</a> algorithm.</p>

<p>Pop-up menus must not, while being shown, reflect changes in the DOM. The menu is constructed
from the DOM before being shown, and is then immutable.</p>
Expand Down Expand Up @@ -56504,7 +56508,7 @@ <h5 id=processing-model-2><span class=secno>4.11.5.2 </span>Processing model</h5
one.</p>

<p>Otherwise, let <var title="">subject</var> be the element for which the menu was requested, and
let <var title="">menu</var> be the <a href=#assigned-context-menu>assigned context menu</a> of <var title="">target</var> immediately after the code title="event-contextmenu"&gt;contextmenu
let <var title="">menu</var> be the <a href=#assigned-context-menu>assigned context menu</a> of <var title="">target</var> immediately after the <code title=event-contextmenu>contextmenu</code>
event's dispatch has completed. The user agent must <a href=#concept-event-fire title=concept-event-fire>fire</a> a
<a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-show>show</code> at <var title="">menu</var>, using the <code><a href=#relatedevent>RelatedEvent</a></code>
interface, with the <code title=dom-RelatedEvent-relatedTarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute
Expand All @@ -56513,7 +56517,7 @@ <h5 id=processing-model-2><span class=secno>4.11.5.2 </span>Processing model</h5

<p>If <em>this</em> event (the <code title=event-show>show</code> event) is not canceled, then
the user agent must <a href=#construct-and-show-a-menu title="construct and show a menu">construct and show</a> the menu for
<var title="">menu</var>.</p>
<var title="">menu</var> with <var title="">subject</var> as the subject.</p>

<p>The user agent may also provide access to its default context menu, if any, with the context
menu shown. For example, it could merge the menu items from the two menus together, or provide the
Expand Down Expand Up @@ -57066,7 +57070,7 @@ <h5 id=using-the-menuitem-element-to-define-a-command><span class=secno>4.11.6.6

<p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
command, if the element has a defined <a href=#activation-behavior>activation
behavior</a>, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
behavior</a><!-- it doesn't if the element is disabled -->, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
steps</a> on the element. Otherwise, it is just to <a href=#fire-a-click-event>fire a
<code title=event-click>click</code> event</a> at the
element.</p>
Expand Down Expand Up @@ -71976,6 +71980,7 @@ <h5 id=event-handlers-on-elements,-document-objects,-and-window-objects><span cl
<div class=impl>

<h5 id=event-firing><span class=secno>7.1.6.3 </span>Event firing</h5>
<!--CLEANUP-->

<p>Certain operations and methods are defined as firing events on
elements. For example, the <code title=dom-click><a href=#dom-click>click()</a></code>
Expand All @@ -71995,7 +72000,7 @@ <h5 id=event-firing><span class=secno>7.1.6.3 </span>Event firing</h5>
attributes initialized to 0, its <code title="">ctrlKey</code>, <code title="">shiftKey</code>,
<code title="">altKey</code>, and <code title="">metaKey</code> attributes initialized according
to the current state of the key input device, if any (false for any keys that are not available),
its <code title="">detail</code> attribute initialized to 1, and its <code title="">relatedTarget</code> attribute initialized to null. The <code title="">getModifierState()</code> method on the object must return values appropriately
its <code title="">detail</code> attribute initialized to 1, and its <code title="">relatedTarget</code> attribute initialized to null (except where otherwise stated). The <code title="">getModifierState()</code> method on the object must return values appropriately
describing the state of the key input device at the time the event is created.</p>

<p><dfn id=fire-a-click-event title="fire a click event">Firing a <code title=event-click>click</code> event</dfn>
Expand Down
19 changes: 12 additions & 7 deletions index
Expand Up @@ -50169,7 +50169,8 @@ You cannot submit this form when the field is incorrect.</samp></pre>
modifier key information --></li>

<li><p>If the event is not canceled, then <a href=#construct-and-show-a-menu title="construct and show a menu">construct and
show</a> the menu for <var title="">menu</var>.</li>
show</a> the menu for <var title="">menu</var>, with the <code><a href=#the-button-element>button</a></code> element as the
subject.</li>

</ol></dd>

Expand Down Expand Up @@ -56063,7 +56064,7 @@ fur
<ul class=brief><li><a href=#concept-command title=concept-command>Commands</a>, which can be marked as default commands (<code><a href=#the-menuitem-element>menuitem</a></code>)</li>
<li>Separators (<code><a href=#the-hr-element>hr</a></code>)</li>
<li>Other menus, which allows the list to be nested (<code><a href=#the-menu-element>menu</a></code>)</li>
</ul><p>To <dfn id=construct-and-show-a-menu>construct and show a menu</dfn> for a particular <code><a href=#the-menu-element>menu</a></code> element, the user
</ul><!--CLEANUP--><p>To <dfn id=construct-and-show-a-menu>construct and show a menu</dfn> for a particular <code><a href=#the-menu-element>menu</a></code> element and with a particular element as a subject, the user
agent must run the following steps:</p>

<ol><li><p>Let the menu be an empty list of the type described above.</li>
Expand Down Expand Up @@ -56130,7 +56131,10 @@ fur
<p>Display the menu to the user, and let the algorithm that invoked this one continue.</p>

<p>If the user selects a menu item that corresponds to an element that still represents a <a href=#concept-command title=concept-command>command</a> when the user selects it, then the UA must invoke that
command's <a href=#command-facet-action title=command-facet-Action>Action</a>.</p>
command's <a href=#command-facet-action title=command-facet-Action>Action</a>. If the command's <a href=#command-facet-action title=command-facet-Action>Action</a> is defined as <a href=#fire-a-click-event title="fire a click event">firing
a <code title=event-click>click</code> event</a>, either directly or via the <a href=#run-synthetic-click-activation-steps>run
synthetic click activation steps</a> algorithm, then the <code title=dom-MouseEvent-relatedTarget>relatedTarget</code> attribute of that <code title=event-click><a href=#event-click>click</a></code> event must be initialized to the subject passed to this
<a href=#construct-and-show-a-menu>construct and show a menu</a> algorithm.</p>

<p>Pop-up menus must not, while being shown, reflect changes in the DOM. The menu is constructed
from the DOM before being shown, and is then immutable.</p>
Expand Down Expand Up @@ -56504,7 +56508,7 @@ fur
one.</p>

<p>Otherwise, let <var title="">subject</var> be the element for which the menu was requested, and
let <var title="">menu</var> be the <a href=#assigned-context-menu>assigned context menu</a> of <var title="">target</var> immediately after the code title="event-contextmenu"&gt;contextmenu
let <var title="">menu</var> be the <a href=#assigned-context-menu>assigned context menu</a> of <var title="">target</var> immediately after the <code title=event-contextmenu>contextmenu</code>
event's dispatch has completed. The user agent must <a href=#concept-event-fire title=concept-event-fire>fire</a> a
<a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-show>show</code> at <var title="">menu</var>, using the <code><a href=#relatedevent>RelatedEvent</a></code>
interface, with the <code title=dom-RelatedEvent-relatedTarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute
Expand All @@ -56513,7 +56517,7 @@ fur

<p>If <em>this</em> event (the <code title=event-show>show</code> event) is not canceled, then
the user agent must <a href=#construct-and-show-a-menu title="construct and show a menu">construct and show</a> the menu for
<var title="">menu</var>.</p>
<var title="">menu</var> with <var title="">subject</var> as the subject.</p>

<p>The user agent may also provide access to its default context menu, if any, with the context
menu shown. For example, it could merge the menu items from the two menus together, or provide the
Expand Down Expand Up @@ -57066,7 +57070,7 @@ dictionary <dfn id=relatedeventinit>RelatedEventInit</dfn> : <a href=#eventinit>

<p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
command, if the element has a defined <a href=#activation-behavior>activation
behavior</a>, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
behavior</a><!-- it doesn't if the element is disabled -->, is to <a href=#run-synthetic-click-activation-steps>run synthetic click activation
steps</a> on the element. Otherwise, it is just to <a href=#fire-a-click-event>fire a
<code title=event-click>click</code> event</a> at the
element.</p>
Expand Down Expand Up @@ -71976,6 +71980,7 @@ interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
<div class=impl>

<h5 id=event-firing><span class=secno>7.1.6.3 </span>Event firing</h5>
<!--CLEANUP-->

<p>Certain operations and methods are defined as firing events on
elements. For example, the <code title=dom-click><a href=#dom-click>click()</a></code>
Expand All @@ -71995,7 +72000,7 @@ interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
attributes initialized to 0, its <code title="">ctrlKey</code>, <code title="">shiftKey</code>,
<code title="">altKey</code>, and <code title="">metaKey</code> attributes initialized according
to the current state of the key input device, if any (false for any keys that are not available),
its <code title="">detail</code> attribute initialized to 1, and its <code title="">relatedTarget</code> attribute initialized to null. The <code title="">getModifierState()</code> method on the object must return values appropriately
its <code title="">detail</code> attribute initialized to 1, and its <code title="">relatedTarget</code> attribute initialized to null (except where otherwise stated). The <code title="">getModifierState()</code> method on the object must return values appropriately
describing the state of the key input device at the time the event is created.</p>

<p><dfn id=fire-a-click-event title="fire a click event">Firing a <code title=event-click>click</code> event</dfn>
Expand Down
23 changes: 16 additions & 7 deletions source
Expand Up @@ -59544,7 +59544,8 @@ You cannot submit this form when the field is incorrect.</samp></pre>
modifier key information --></p></li>

<li><p>If the event is not canceled, then <span title="construct and show a menu">construct and
show</span> the menu for <var title="">menu</var>.</p></li>
show</span> the menu for <var title="">menu</var>, with the <code>button</code> element as the
subject.</p></li>

</ol>

Expand Down Expand Up @@ -66511,8 +66512,9 @@ fur
<li>Separators (<code>hr</code>)</li>
<li>Other menus, which allows the list to be nested (<code>menu</code>)</li>
</ul>
<!--CLEANUP-->

<p>To <dfn>construct and show a menu</dfn> for a particular <code>menu</code> element, the user
<p>To <dfn>construct and show a menu</dfn> for a particular <code>menu</code> element and with a particular element as a subject, the user
agent must run the following steps:</p>

<ol>
Expand Down Expand Up @@ -66586,7 +66588,13 @@ fur

<p>If the user selects a menu item that corresponds to an element that still represents a <span
title="concept-command">command</span> when the user selects it, then the UA must invoke that
command's <span title="command-facet-Action">Action</span>.</p>
command's <span title="command-facet-Action">Action</span>. If the command's <span
title="command-facet-Action">Action</span> is defined as <span title="fire a click event">firing
a <code title="event-click">click</code> event</span>, either directly or via the <span>run
synthetic click activation steps</span> algorithm, then the <code
title="dom-MouseEvent-relatedTarget">relatedTarget</code> attribute of that <code
title="event-click">click</code> event must be initialized to the subject passed to this
<span>construct and show a menu</span> algorithm.</p>

<p>Pop-up menus must not, while being shown, reflect changes in the DOM. The menu is constructed
from the DOM before being shown, and is then immutable.</p>
Expand Down Expand Up @@ -67031,7 +67039,7 @@ fur

<p>Otherwise, let <var title="">subject</var> be the element for which the menu was requested, and
let <var title="">menu</var> be the <span>assigned context menu</span> of <var
title="">target</var> immediately after the code title="event-contextmenu">contextmenu</code>
title="">target</var> immediately after the <code title="event-contextmenu">contextmenu</code>
event's dispatch has completed. The user agent must <span title="concept-event-fire">fire</span> a
<span title="concept-events-trusted">trusted</span> event with the name <code
title="event-show">show</code> at <var title="">menu</var>, using the <code>RelatedEvent</code>
Expand All @@ -67041,7 +67049,7 @@ fur

<p>If <em>this</em> event (the <code title="event-show">show</code> event) is not canceled, then
the user agent must <span title="construct and show a menu">construct and show</span> the menu for
<var title="">menu</var>.</p>
<var title="">menu</var> with <var title="">subject</var> as the subject.</p>

<p>The user agent may also provide access to its default context menu, if any, with the context
menu shown. For example, it could merge the menu items from the two menus together, or provide the
Expand Down Expand Up @@ -67704,7 +67712,7 @@ dictionary <dfn>RelatedEventInit</dfn> : <span>EventInit</span> {

<p>The <span title="command-facet-Action">Action</span> of the
command, if the element has a defined <span>activation
behavior</span>, is to <span>run synthetic click activation
behavior</span><!-- it doesn't if the element is disabled -->, is to <span>run synthetic click activation
steps</span> on the element. Otherwise, it is just to <span>fire a
<code title="event-click">click</code> event</span> at the
element.</p>
Expand Down Expand Up @@ -85062,6 +85070,7 @@ interface <dfn>WindowEventHandlers</dfn> {
<div class="impl">

<h5>Event firing</h5>
<!--CLEANUP-->

<p>Certain operations and methods are defined as firing events on
elements. For example, the <code title="dom-click">click()</code>
Expand All @@ -85086,7 +85095,7 @@ interface <dfn>WindowEventHandlers</dfn> {
<code title="">altKey</code>, and <code title="">metaKey</code> attributes initialized according
to the current state of the key input device, if any (false for any keys that are not available),
its <code title="">detail</code> attribute initialized to 1, and its <code
title="">relatedTarget</code> attribute initialized to null. The <code
title="">relatedTarget</code> attribute initialized to null (except where otherwise stated). The <code
title="">getModifierState()</code> method on the object must return values appropriately
describing the state of the key input device at the time the event is created.</p>

Expand Down

0 comments on commit 700bd49

Please sign in to comment.