Skip to content

Commit

Permalink
[giow] (1) Add a .relatedTarget attribute on 'show' events for <menu>…
Browse files Browse the repository at this point in the history
… elements.

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

git-svn-id: http://svn.whatwg.org/webapps@7791 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 3, 2013
1 parent 63c9b15 commit f1a3b24
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 73 deletions.
95 changes: 69 additions & 26 deletions complete.html
Expand Up @@ -248,7 +248,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 April 2013</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 3 April 2013</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -774,7 +774,8 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 April 2013</h2>
<li><a href=#context-menus><span class=secno>4.11.5 </span>Context menus</a>
<ol>
<li><a href=#declaring-a-context-menu><span class=secno>4.11.5.1 </span>Declaring a context menu</a></li>
<li><a href=#processing-model-2><span class=secno>4.11.5.2 </span>Processing model</a></ol></li>
<li><a href=#processing-model-2><span class=secno>4.11.5.2 </span>Processing model</a></li>
<li><a href=#event-definitions-0><span class=secno>4.11.5.3 </span>Event definitions</a></ol></li>
<li><a href=#commands><span class=secno>4.11.6 </span>Commands</a>
<ol>
<li><a href=#facets-0><span class=secno>4.11.6.1 </span>Facets</a></li>
Expand Down Expand Up @@ -914,7 +915,7 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 April 2013</h2>
<li><a href=#scroll-to-fragid><span class=secno>6.6.9 </span>Navigating to a fragment identifier</a></li>
<li><a href=#history-traversal><span class=secno>6.6.10 </span>History traversal</a>
<ol>
<li><a href=#event-definitions-0><span class=secno>6.6.10.1 </span>Event definitions</a></ol></li>
<li><a href=#event-definitions-1><span class=secno>6.6.10.1 </span>Event definitions</a></ol></li>
<li><a href=#unloading-documents><span class=secno>6.6.11 </span>Unloading documents</a>
<ol>
<li><a href=#event-definition><span class=secno>6.6.11.1 </span>Event definition</a></ol></li>
Expand Down Expand Up @@ -1067,7 +1068,7 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 April 2013</h2>
<li><a href=#worker-locations><span class=secno>9.3.4 </span>Worker locations</a></ol></ol></li>
<li><a href=#comms><span class=secno>10 </span>Communication</a>
<ol>
<li><a href=#event-definitions-1><span class=secno>10.1 </span>Event definitions</a></li>
<li><a href=#event-definitions-2><span class=secno>10.1 </span>Event definitions</a></li>
<li><a href=#server-sent-events><span class=secno>10.2 </span>Server-sent events</a>
<ol>
<li><a href=#server-sent-events-intro><span class=secno>10.2.1 </span>Introduction</a></li>
Expand All @@ -1089,7 +1090,7 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 1 April 2013</h2>
<li><a href=#feedback-from-the-protocol><span class=secno>10.3.3 </span>Feedback from the protocol</a></li>
<li><a href=#ping-and-pong-frames><span class=secno>10.3.4 </span>Ping and Pong frames</a></li>
<li><a href=#parsing-websocket-urls><span class=secno>10.3.5 </span>Parsing WebSocket URLs</a></li>
<li><a href=#event-definitions-2><span class=secno>10.3.6 </span>Event definitions</a></li>
<li><a href=#event-definitions-3><span class=secno>10.3.6 </span>Event definitions</a></li>
<li><a href=#garbage-collection-1><span class=secno>10.3.7 </span>Garbage collection</a></ol></li>
<li><a href=#web-messaging><span class=secno>10.4 </span>Cross-document messaging</a>
<ol>
Expand Down Expand Up @@ -50162,8 +50163,10 @@ <h4 id=the-button-element><span class=secno>4.10.8 </span>The <dfn><code>button<
<li><p>Let <var title="">menu</var> be the element's <a href=#designated-pop-up-menu>designated pop-up menu</a>, if
any. If there isn't one, then abort these steps.</li>

<li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-show>show</code> that is
cancelable at <var title="">menu</var>. <!-- v2: include modifier key information --></li>
<li><p><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
initialized to the <code><a href=#the-button-element>button</a></code> element. The event must be cancelable. <!-- v2: include
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>
Expand Down Expand Up @@ -56462,10 +56465,14 @@ <h5 id=declaring-a-context-menu><span class=secno>4.11.5.1 </span>Declaring a co

<h5 id=processing-model-2><span class=secno>4.11.5.2 </span>Processing model</h5>

<p>If there is no element with the ID given by an element's <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute's value in the element's <a href=#home-subtree>home
subtree</a>, or if the first such element is not a <code><a href=#the-menu-element>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup
menu</a> state, then the element has no assigned context menu. Otherwise, the element's
assigned context menu is the first such element.</p>
<p>Each element has an <dfn id=assigned-context-menu>assigned context menu</dfn>, which can be null. If an element <var title="">A</var> has a <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute, and there is
an element with the ID given by <var title="">A</var>'s <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute's value in <var title="">A</var>'s
<a href=#home-subtree>home subtree</a>, and the first such element in <a href=#tree-order>tree order</a> is a
<code><a href=#the-menu-element>menu</a></code> element whose <code title=attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state title="popup menu state">popup menu</a> state, then <var title="">A</var>'s <a href=#assigned-context-menu>assigned
context menu</a> is that element. Otherwise, if <var title="">A</var> has a parent element,
then <var title="">A</var>'s <a href=#assigned-context-menu>assigned context menu</a> is the <a href=#assigned-context-menu>assigned context
menu</a> of its parent element. Otherwise, <var title="">A</var>'s <a href=#assigned-context-menu>assigned context
menu</a> is null.</p>

<p>When an element's context menu is requested (e.g. by the user right-clicking the element, or
pressing a context menu key), the user agent must apply the appropriate rules from the following
Expand All @@ -56489,18 +56496,24 @@ <h5 id=processing-model-2><span class=secno>4.11.5.2 </span>Processing model</h5
of events is UA-dependent, as it will vary based on platform conventions.</p>

<p>The default action of the <code title=event-contextmenu>contextmenu</code> event depends on
whether or not the element or one of its ancestors has a context menu assigned (using the <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute) when the event dispatch has completed. If
there is no context menu assigned, the default action must be for the user agent to show its
default context menu, if it has one.</p>

<p>If the element or one of its ancestors <em>does</em> have a context menu assigned, then the
user agent must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-show>show</code> that
is cancelable at the <code><a href=#the-menu-element>menu</a></code> element of the context menu of the nearest ancestor
(including the element itself) with one assigned.</p> <!-- v2: include modifier key information
-->
whether or not the element for which the menu was requested has a non-null <a href=#assigned-context-menu>assigned context
menu</a> when the event dispatch has completed, as follows.</p>

<p>If the <a href=#assigned-context-menu>assigned context menu</a> of the element for which the menu was requested is
null, the default action must be for the user agent to show its default context menu, if it has
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
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
initialized to <var title="">subject</var>. The event must be cancelable. <!-- v2: include
modifier key information --></p>

<p>The default action of <em>this</em> event is that the user agent must <a href=#construct-and-show-a-menu title="construct
and show a menu">construct and show</a> the menu for the <code><a href=#the-menu-element>menu</a></code> element.</p>
<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>

<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 All @@ -56512,12 +56525,41 @@ <h5 id=processing-model-2><span class=secno>4.11.5.2 </span>Processing model</h5
<code title=event-contextmenu>contextmenu</code> event and instead always shows the default
context menu.</p>

<p>The <dfn id=dom-contextmenu title=dom-contextMenu><code>contextMenu</code></dfn> IDL attribute must
<hr><p>The <dfn id=dom-contextmenu title=dom-contextMenu><code>contextMenu</code></dfn> IDL attribute must
<a href=#reflect>reflect</a> the <code title=attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> content attribute.</p>

</div>


<h5 id=event-definitions-0><span class=secno>4.11.5.3 </span>Event definitions</h5>

<pre class=idl>[Constructor(DOMString type, optional <a href=#relatedeventinit>RelatedEventInit</a> eventInitDict)]
interface <dfn id=relatedevent>RelatedEvent</dfn> : <a href=#event>Event</a> {
readonly attribute <a href=#eventtarget>EventTarget</a>? <a href=#dom-relatedevent-relatedtarget title=dom-RelatedEvent-relatedTarget>relatedTarget</a>;
};

dictionary <dfn id=relatedeventinit>RelatedEventInit</dfn> : <a href=#eventinit>EventInit</a> {
<a href=#eventtarget>EventTarget</a>? relatedTarget;
};</pre>

<dl class=domintro><dt><var title="">event</var> . <code title=dom-RelatedEvent-relatedTarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code></dt>

<dd>

<p>Returns the other event target involved in this event. For example, when a <code title=event-show>show</code> event fires on a <code><a href=#the-menu-element>menu</a></code> element, the other event
target involved in the event would be the element for which the menu is being shown.</p>

</dd>

</dl><div class=impl>

<p>The <dfn id=dom-relatedevent-relatedtarget title=dom-RelatedEvent-relatedTarget><code>relatedTarget</code></dfn> attribute must
return the value it was initialized to. When the object is created, this attribute must be
initialized to null. It represents the other event target that is related to the event.</p>

</div>




<h4 id=commands><span class=secno>4.11.6 </span>Commands</h4>
Expand Down Expand Up @@ -67986,7 +68028,7 @@ <h4 id=history-traversal><span class=secno>6.6.10 </span>History traversal</h4>
source</a>.</p>


<h5 id=event-definitions-0><span class=secno>6.6.10.1 </span>Event definitions</h5>
<h5 id=event-definitions-1><span class=secno>6.6.10.1 </span>Event definitions</h5>

</div>

Expand Down Expand Up @@ -79902,7 +79944,7 @@ <h2 id=comms><span class=secno>10 </span>Communication</h2>



<h3 id=event-definitions-1><span class=secno>10.1 </span>Event definitions</h3>
<h3 id=event-definitions-2><span class=secno>10.1 </span>Event definitions</h3>

<p>Messages in <a href=#server-sent-events>server-sent events</a>, <a href=#network>Web sockets</a>, <a href=#web-messaging>cross-document
messaging</a>, and <a href=#channel-messaging>channel messaging</a> use the <dfn id=event-message title=event-message><code>message</code></dfn> event. </p>
Expand Down Expand Up @@ -81537,7 +81579,7 @@ <h4 id=parsing-websocket-urls><span class=secno>10.3.5 </span>Parsing WebSocket
<li><p>Return <var title="">host</var>, <var title="">port</var>, <var title="">resource
name</var>, and <var title="">secure</var>.</li>

</ol><h4 id=event-definitions-2><span class=secno>10.3.6 </span>Event definitions</h4>
</ol><h4 id=event-definitions-3><span class=secno>10.3.6 </span>Event definitions</h4>

<pre class=idl>[Constructor(DOMString type, optional <a href=#closeeventinit>CloseEventInit</a> eventInitDict)]
interface <dfn id=closeevent>CloseEvent</dfn> : <a href=#event>Event</a> {
Expand Down Expand Up @@ -100823,6 +100865,7 @@ <h3 class="no-num">Reflecting IDL attributes</h3>
<li><code><a href=#portcollection>PortCollection</a></code>
<li><code><a href=#propertynodelist>PropertyNodeList</a></code>
<li><code><a href=#radionodelist>RadioNodeList</a></code>
<li><code><a href=#relatedevent>RelatedEvent</a></code>
<li><code>Screen</code>, <a href=#Screen-partial>partial</a>
<li><code><a href=#sharedworker>SharedWorker</a></code>
<li><code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
Expand Down

0 comments on commit f1a3b24

Please sign in to comment.