hixie: Add examples of <command>. (whatwg r4159)

hixie: Add examples of <command>. (whatwg r4159)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3306&r2=1.3307&f=h
http://html5.org/tools/web-apps-tracker?from=4158&to=4159

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3306
retrieving revision 1.3307
diff -u -d -r1.3306 -r1.3307
--- Overview.html 18 Oct 2009 05:41:00 -0000 1.3306
+++ Overview.html 18 Oct 2009 07:13:28 -0000 1.3307
@@ -37769,7 +37769,7 @@
   or a selection of one item from a list of items.<p>The attribute is an <a href="#enumerated-attribute">enumerated attribute</a> with three
   keywords and states. The "<dfn id="attr-command-type-keyword-command" title="attr-command-type-keyword-command"><code>command</code></dfn>"
   keyword maps to the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state, the
-  <dfn id="attr-command-type-keyword-checkbox" title="attr-command-type-keyword-checkbox"><code>checkbox</code></dfn>"
+  "<dfn id="attr-command-type-keyword-checkbox" title="attr-command-type-keyword-checkbox"><code>checkbox</code></dfn>"
   keyword maps to the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state, and
   the "<dfn id="attr-command-type-keyword-radio" title="attr-command-type-keyword-radio"><code>radio</code></dfn>"
   keyword maps to the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state. The
@@ -37887,7 +37887,27 @@
   facet again. -->
 
   </div><p class="note"><code><a href="#the-command">command</a></code> elements are not rendered
-  unless they <a href="#menus" title="menu">form part of a menu</a>.<h4 id="menus"><span class="secno">4.11.3 </span>The <dfn><code>menu</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><dl class="element"><dt>Categories</dt>
+  unless they <a href="#menus" title="menu">form part of a menu</a>.<div class="example">
+
+   <p>Here is an example of a toolbar with three buttons that let the
+   user toggle between left, center, and right alignment. One could
+   imagine such a toolbar as part of a text editor. The toolbar also
+   has a separator followed by another button labeled "Publish",
+   though that button is disabled.</p>
+
+   <pre>&lt;menu type="toolbar"&gt;
+ &lt;command type="radio" radiogroup="alignment" checked="checked"
+          label="Left" icon="icons/alL.png" onclick="setAlign('left')"&gt;
+ &lt;command type="radio" radiogroup="alignment"
+          label="Center" icon="icons/alC.png" onclick="setAlign('center')"&gt;
+ &lt;command type="radio" radiogroup="alignment"
+          label="Right" icon="icons/alR.png" onclick="setAlign('right')"&gt;
+ &lt;hr&gt;
+ &lt;command type="command" disabled
+          label="Publish" icon="icons/pub.png" onclick="publish()"&gt;
+&lt;/menu&gt;</pre>
+
+  </div><h4 id="menus"><span class="secno">4.11.3 </span>The <dfn><code>menu</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><dl class="element"><dt>Categories</dt>
    <dd><a href="#flow-content">Flow content</a>.</dd>
    <dd>If the element's <code title="attr-menu-type"><a href="#attr-menu-type">type</a></code> attribute is in the <a href="#toolbar-state" title="toolbar state">toolbar</a> state: <a href="#interactive-content">Interactive content</a>.</dd>
    <dt>Contexts in which this element may be used:</dt>
@@ -38124,6 +38144,23 @@
   <p>The <dfn id="dom-contextmenu" title="dom-contextMenu"><code>contextMenu</code></dfn>
   attribute must <a href="#reflect">reflect</a> the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> content attribute.</p>
 
+  </div><div class="example">
+
+   <p>Here is an example of a context menu for an input control:</p>
+
+   <pre>&lt;form name="npc"&gt;
+ &lt;label&gt;Character name: &lt;input name=char type=text contextmenu=namemenu required&gt;&lt;/label&gt;
+ &lt;menu type=context id=namemenu&gt;
+  &lt;command label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()"&gt;
+  &lt;command label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)"&gt;
+ &lt;/menu&gt;
+&lt;/form&gt;</pre>
+
+   <p>This adds to items to the control's context menu, one called
+   "Pick random name", and one called "Prefill other fields based on
+   name". They invoke scripts that are not shown in the example
+   above.</p>
+
   </div><div class="impl">
 
   <h5 id="toolbars"><span class="secno">4.11.3.4 </span><dfn>Toolbars</dfn></h5>

Received on Sunday, 18 October 2009 07:14:13 UTC