Skip to content

Commit

Permalink
[acgiow] (0) Define <command command='foo'> to reference other commands
Browse files Browse the repository at this point in the history
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@6995 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 15, 2012
1 parent 51d1d77 commit 6b4f63b
Show file tree
Hide file tree
Showing 3 changed files with 393 additions and 60 deletions.
152 changes: 128 additions & 24 deletions complete.html
Expand Up @@ -240,7 +240,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 14 February 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 15 February 2012</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 @@ -757,9 +757,10 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 14 February 2012<
<li><a href=#using-the-option-element-to-define-a-command><span class=secno>4.11.5.4 </span>Using the <code>option</code> element to define a command</a></li>
<li><a href=#using-the-command-element-to-define-a-command><span class=secno>4.11.5.5 </span>Using the <code>command</code> element to define
a command</a></li>
<li><a href=#using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.5.6 </span>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>label</code> element to define a command</a></li>
<li><a href=#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.5.7 </span>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>legend</code> element to define a command</a></li>
<li><a href=#using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.5.8 </span>Using the <code title=attr-accesskey>accesskey</code> attribute to define a command on other elements</a></ol></ol></li>
<li><a href=#using-the-command-attribute-on-command-elements-to-define-a-command-indirectly><span class=secno>4.11.5.6 </span>Using the <code title=attr-command-command>command</code> attribute on <code>command</code> elements to define a command indirectly</a></li>
<li><a href=#using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.5.7 </span>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>label</code> element to define a command</a></li>
<li><a href=#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.5.8 </span>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>legend</code> element to define a command</a></li>
<li><a href=#using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.5.9 </span>Using the <code title=attr-accesskey>accesskey</code> attribute to define a command on other elements</a></ol></ol></li>
<li><a href=#links><span class=secno>4.12 </span>Links</a>
<ol>
<li><a href=#introduction-3><span class=secno>4.12.1 </span>Introduction</a></li>
Expand Down Expand Up @@ -53236,6 +53237,7 @@ <h4 id=the-command-element><span class=secno>4.11.3 </span>The <dfn id=the-comma
<dd><code title=attr-command-checked><a href=#attr-command-checked>checked</a></code></dd>
<dd><code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code></dd>
<!--<dd><code title="attr-command-default">default</code></dd>-->
<dd><code title=attr-command-command><a href=#attr-command-command>command</a></code></dd>
<dd>Also, the <code title=attr-command-title><a href=#attr-command-title>title</a></code> attribute has special semantics on this element.</dd>
<dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
<dd>
Expand All @@ -53247,18 +53249,34 @@ <h4 id=the-command-element><span class=secno>4.11.3 </span>The <dfn id=the-comma
attribute boolean <a href=#dom-command-checked title=dom-command-checked>checked</a>;
attribute DOMString <a href=#dom-command-radiogroup title=dom-command-radiogroup>radiogroup</a>;<!--
attribute boolean <span title="dom-command-default">default</span>;-->
readonly attribute <a href=#htmlelement>HTMLElement</a>? <a href=#dom-command-command title=dom-command-command>command</a>;
};</pre>
</dd>
</dl><!--TOPIC:HTML--><p>The <code><a href=#the-command-element>command</a></code> element represents a command that the user
can invoke.</p>

<p>A command can be part of a context menu or toolbar, using the
<code><a href=#the-menu-element>menu</a></code> element, or can be put anywhere else in the page,
to define a keyboard shortcut.</p> <!-- in the future we'll also add
a command="" attribute to refer to a command, which can then be
defined anywhere -->

<p>The <dfn id=attr-command-type title=attr-command-type><code>type</code></dfn>
<p>A command can be explicitly part of a context menu or toolbar,
using the <code><a href=#the-menu-element>menu</a></code> element. It can also be put anywhere
else on a page, either just to define a keyboard shortcut, or to
define a command that is then referenced from other
<code><a href=#the-command-element>command</a></code> elements.</p>

<p>A <code><a href=#the-command-element>command</a></code> element that uses the
<code title=attr-command-type><a href=#attr-command-type>type</a></code>,
<code title=attr-command-label><a href=#attr-command-label>label</a></code>,
<code title=attr-command-icon><a href=#attr-command-icon>icon</a></code>,
<code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code>,
<code title=attr-command-checked><a href=#attr-command-checked>checked</a></code>,
<code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code>,
<!--<code title="attr-command-default">default</code>,--> and
<code title=attr-title><a href=#the-title-attribute>title</a></code> attributes defines a new
command. A <code><a href=#the-command-element>command</a></code> element that uses the <code title=attr-command-command><a href=#attr-command-command>command</a></code> <em>attribute</em>
defines a command by reference to another one. This allows authors
to define a command once, and set its state (e.g. whether it is
active or disabled) in one place, and have all references to that
command in the user interface change at the same time.</p>

<hr><p>The <dfn id=attr-command-type title=attr-command-type><code>type</code></dfn>
attribute indicates the kind of command: either a normal command
with an associated action, or a state or option that can be toggled,
or a selection of one item from a list of items.</p>
Expand Down Expand Up @@ -53357,7 +53375,29 @@ <h4 id=the-command-element><span class=secno>4.11.3 </span>The <dfn id=the-comma
</div>
-->

<div class=impl>
<hr><p>If a <code><a href=#the-command-element>command</a></code> element <var title="">slave</var> has a
<dfn id=attr-command-command title=attr-command-command><code>command</code></dfn>
attribute, and <var title="">slave</var> is <a href=#in-a-document>in a
<code>Document</code></a>, and there is an element in that
<code><a href=#document>Document</a></code> whose <a href=#concept-id title=concept-id>ID</a> has a
value equal to the value of <var title="">slave</var>'s <code title=attr-command-command><a href=#attr-command-command>command</a></code> attribute, and the first
such element in <a href=#tree-order>tree order</a>, hereafter <var title="">master</var>, itself <a href=#concept-command title=concept-command>defines
a command</a> and either is not a <code><a href=#the-command-element>command</a></code> element or
does not itself have a <code title=attr-command-command><a href=#attr-command-command>command</a></code> attribute, then the
<dfn id=master-command>master command</dfn> of <var title="">slave</var> is <var title="">master</var>.</p>

<p>An element with a
<code title=attr-command-command><a href=#attr-command-command>command</a></code>
attribute must have a <a href=#master-command>master command</a> and must not have any
<code title=attr-command-type><a href=#attr-command-type>type</a></code>,
<code title=attr-command-label><a href=#attr-command-label>label</a></code>,
<code title=attr-command-icon><a href=#attr-command-icon>icon</a></code>,
<code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code>,
<code title=attr-command-checked><a href=#attr-command-checked>checked</a></code>, or
<code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code>
attributes.</p>

<hr><div class=impl>

<p>The <dfn id=dom-command-type title=dom-command-type><code>type</code></dfn> IDL
attribute must <a href=#reflect>reflect</a> the content attribute of the
Expand All @@ -53368,11 +53408,22 @@ <h4 id=the-command-element><span class=secno>4.11.3 </span>The <dfn id=the-comma
IDL attributes must <a href=#reflect>reflect</a> the respective content
attributes of the same name.</p>

<p>The element's <a href=#activation-behavior>activation behavior</a> depends on the
value of the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute
of the element, as follows:</p>
<p>The <dfn id=dom-command-command title=dom-command-command><code>command</code></dfn>
IDL attribute must return the <a href=#master-command>master command</a>, if any,
or null otherwise.</p>

<hr><p>The element's <a href=#activation-behavior>activation behavior</a> depends on the
element's <code title=attr-command-type><a href=#attr-command-type>type</a></code> and <code title=attr-command-command><a href=#attr-command-command>command</a></code> attributes, as
follows:</p>

<dl class=switch><dt>If the element has a <a href=#master-command>master command</a> set by its
<code title=attr-command-command><a href=#attr-command-command>command</a></code> attribute</dt>

<dd><p>The user agent must <a href=#run-synthetic-click-activation-steps>run synthetic click activation
steps</a> on the element's <a href=#master-command>master command</a>.</dd>

<dl class=switch><dt>If the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is

<dt>If the <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is
in the <a href=#attr-command-type-state-checkbox title=attr-command-type-state-checkbox>Checkbox</a> state</dt>

<dd><p>If the element has a <code title=attr-command-checked><a href=#attr-command-checked>checked</a></code> attribute, the UA must
Expand Down Expand Up @@ -54221,10 +54272,11 @@ <h5 id=using-the-option-element-to-define-a-command><span class=secno>4.11.5.4 <
element.</p>



<h5 id=using-the-command-element-to-define-a-command><span class=secno>4.11.5.5 </span>Using the <dfn title=command-element><code>command</code></dfn> element to define
a command</h5>

<p>A <code><a href=#the-command-element>command</a></code> element <a href=#concept-command title=concept-command>defines a command</a>.</p>
<p>A <code><a href=#the-command-element>command</a></code> element that does not have a <code title=attr-command-command><a href=#attr-command-command>command</a></code> attribute <a href=#concept-command title=concept-command>defines a command</a>.</p>

<p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
is "radio" if the <code><a href=#the-command-element>command</a></code>'s <code title=attr-command-type><a href=#attr-command-type>type</a></code> attribute is
Expand Down Expand Up @@ -54276,9 +54328,56 @@ <h5 id=using-the-command-element-to-define-a-command><span class=secno>4.11.5.5



<h5 id=using-the-command-attribute-on-command-elements-to-define-a-command-indirectly><span class=secno>4.11.5.6 </span><dfn title=command-command-command>Using the <code title=attr-command-command>command</code> attribute on <code>command</code> elements to define a command indirectly</dfn></h5>

<p>A <code><a href=#the-command-element>command</a></code> element with a <a href=#master-command>master command</a>
<a href=#concept-command title=concept-command>defines a command</a>.</p>

<p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
is the <a href=#command-facet-type title=command-facet-Type>Type</a> of the
<a href=#master-command>master command</a>.</p>

<p>The <a href=#command-facet-id title=command-facet-ID>ID</a> of the command is
the value of the <code title=attr-id><a href=#the-id-attribute>id</a></code> attribute of the
element, if the attribute is present and not empty. Otherwise the
command is an <a href=#anonymous-command>anonymous command</a>.</p>

<h5 id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.5.6 </span><dfn title=label-command>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>label</code> element to define a command</dfn></h5>
<p>The <a href=#command-facet-label title=command-facet-Label>Label</a> of the command
is the <a href=#command-facet-label title=command-facet-Label>Label</a> of the
<a href=#master-command>master command</a>.</p>

<p>If the element has a <code title=attr-title><a href=#the-title-attribute>title</a></code>
attribute, then the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of
the command is the value of that <code title=attr-title><a href=#the-title-attribute>title</a></code> attribute. Otherwise, the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the command is the <a href=#command-facet-hint title=command-facet-Hint>Hint</a> of the <a href=#master-command>master
command</a>.</p>

<p>The <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the command
is the <a href=#command-facet-icon title=command-facet-Icon>Icon</a> of the
<a href=#master-command>master command</a>.</p>

<p>The <a href=#command-facet-accesskey title=command-facet-AccessKey>AccessKey</a> of the
command is the element's <a href=#assigned-access-key>assigned access key</a>, if
any.</p>

<p>The <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden State</a>
of the command is the <a href=#command-facet-hiddenstate title=command-facet-HiddenState>Hidden
State</a> of the <a href=#master-command>master command</a>.</p>

<p>The <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled
State</a> of the command is the <a href=#command-facet-disabledstate title=command-facet-DisabledState>Disabled State</a> of the
<a href=#master-command>master command</a>.</p>

<p>The <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked
State</a> of the command is the <a href=#command-facet-checkedstate title=command-facet-CheckedState>Checked State</a> of the
<a href=#master-command>master command</a>.</p>

<p>The <a href=#command-facet-action title=command-facet-Action>Action</a> of the
command is to invoke the <a href=#command-facet-action title=command-facet-Action>Action</a> of the <a href=#master-command>master
command</a>.</p>



<h5 id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command><span class=secno>4.11.5.7 </span><dfn title=label-command>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>label</code> element to define a command</dfn></h5>

<p>A <code><a href=#the-label-element>label</a></code> element that has an <a href=#assigned-access-key>assigned access
key</a> and a <a href=#labeled-control>labeled control</a> and whose
Expand Down Expand Up @@ -54319,7 +54418,7 @@ <h5 id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command><spa



<h5 id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.5.7 </span><dfn title=legend-command>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>legend</code> element to define a command</dfn></h5>
<h5 id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><span class=secno>4.11.5.8 </span><dfn title=legend-command>Using the <code title=attr-accesskey>accesskey</code> attribute on a <code>legend</code> element to define a command</dfn></h5>

<p>A <code><a href=#the-legend-element>legend</a></code> element that has an <a href=#assigned-access-key>assigned access
key</a> and is a child of a <code><a href=#the-fieldset-element>fieldset</a></code> element that
Expand Down Expand Up @@ -54363,14 +54462,14 @@ <h5 id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command><sp



<h5 id=using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.5.8 </span><dfn title=accesskey-command>Using the <code title=attr-accesskey>accesskey</code> attribute to define a command on other elements</dfn></h5>
<h5 id=using-the-accesskey-attribute-to-define-a-command-on-other-elements><span class=secno>4.11.5.9 </span><dfn title=accesskey-command>Using the <code title=attr-accesskey>accesskey</code> attribute to define a command on other elements</dfn></h5>

<p>An element that has an <a href=#assigned-access-key>assigned access key</a> <a href=#concept-command title=concept-command>defines a command</a>.</p>

<p>If one of the other sections that define elements that <a href=#concept-command title=concept-command>define commands</a> define that this
<p>If one of the earlier sections that define elements that <a href=#concept-command title=concept-command>define commands</a> define that this
element <a href=#concept-command title=concept-command>defines a command</a>, then
that section applies to this element, and this section does
not. Otherwise, this section applies to that element.</p>
that section applies to this element, and this section does not.
Otherwise, this section applies to that element.</p>

<p>The <a href=#command-facet-type title=command-facet-Type>Type</a> of the command
is "command".</p>
Expand Down Expand Up @@ -94865,7 +94964,8 @@ <h3 class=no-num id=elements-1>Elements</h3>
<code title=attr-command-icon><a href=#attr-command-icon>icon</a></code>;
<code title=attr-command-disabled><a href=#attr-command-disabled>disabled</a></code>;
<code title=attr-command-checked><a href=#attr-command-checked>checked</a></code>;
<code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code></td>
<code title=attr-command-radiogroup><a href=#attr-command-radiogroup>radiogroup</a></code>;
<code title=attr-command-command><a href=#attr-command-command>command</a></code></td>
<td><code><a href=#htmlcommandelement>HTMLCommandElement</a></code></td>
</tr><!--DATA--><!--FORK--><tr><th><code><a href=#the-data-element>data</a></code></th>
<td>Machine-readable equivalent</td>
Expand Down Expand Up @@ -96248,6 +96348,10 @@ <h3 class=no-num id=element-content-categories>Element content categories</h3>
<code title=attr-tdth-colspan><a href=#attr-tdth-colspan>th</a></code>
<td> Number of columns that the cell is to span
<td> <a href=#valid-non-negative-integer>Valid non-negative integer</a> greater than zero
<tr><th> <code title="">command</code>
<td> <code title=attr-command-command><a href=#attr-command-command>command</a></code>
<td> Command definition
<td> <a href=#concept-id title=concept-id>ID</a>*
<tr><th> <code title="">content</code>
<td> <code title=attr-meta-content><a href=#attr-meta-content>meta</a></code>
<td> Value of the element
Expand Down

0 comments on commit 6b4f63b

Please sign in to comment.