Fold keypress event data into Appendix B. Add keypress event order information.
authorGary Kacmarcik <garykac@google.com>
Sat, 17 Aug 2013 09:39:08 -0700
changeset 449 a6cde41aa6c3
parent 448 3ee715d0997e
child 450 90bf209cc7af
Fold keypress event data into Appendix B. Add keypress event order information.
html/DOM3-Events.html
--- a/html/DOM3-Events.html	Sat Aug 17 09:00:53 2013 -0700
+++ b/html/DOM3-Events.html	Sat Aug 17 09:39:08 2013 -0700
@@ -4602,86 +4602,6 @@
 					</dl>
 				</div>
 
-				<!-- keypress -->
-				<div class="event-definition">
-					<dl>
-						<dt id="event-type-keypress"><dfn><a class="eventtype" href="#event-type-keypress"><code>keypress</code></a></dfn></dt>
-						<dd>
-							<table border="0" summary="This table contains information about the semantics of the given event type" cellpadding="2" cellspacing="0">
-								<tr>
-									<th>Type</th>
-									<td><strong><code>keypress</code></strong></td>
-								</tr>
-								<tr>
-									<th>Interface</th>
-									<td><a href="#events-KeyboardEvent"><code>KeyboardEvent</code></a></td>
-								</tr>
-								<tr>
-									<th>Sync / Async</th>
-									<td>Sync</td>
-								</tr>
-								<tr>
-									<th>Bubbles</th>
-									<td>Yes</td>
-								</tr>
-								<tr>
-									<th>Target</th>
-									<td><code>Document</code>, <code>Element</code></td>
-								</tr>
-								<tr>
-									<th>Cancelable</th>
-									<td>Yes</td>
-								</tr>
-								<tr>
-									<th>Default action</th>
-									<td>Varies: launch <a class="def" href="#glossary-text-composition-system">text composition system</a>; <a class="eventtype" href="#event-type-blur"><code>blur</code></a>
-										and <a class="eventtype" href="#event-type-focus"><code>focus</code></a> events; <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a>
-										event; other event</td>
-								</tr>
-								<tr>
-									<th>Context info</th>
-									<td>
-										<ul>
-											<li><a href="#events-event-type-target"><code class="attribute-name">Event.target</code></a>: focused element processing the key event, root element if no suitable
-												input element focused</li>
-											<li><a href="#events-UIEvent-view"><code class="attribute-name">UIEvent.view</code></a>: <a class="def" href="#glossary-defaultView"><code>defaultView</code></a></li>
-											<li><a href="#events-UIEvent-detail"><code class="attribute-name">UIEvent.detail</code></a>: <code>0</code></li>
-											<li><a href="#events-KeyboardEvent-key"><code class="attribute-name">KeyboardEvent.key</code></a>: the key value of the key pressed.</li>
-											<li><a href="#events-KeyboardEvent-location"><code class="attribute-name">KeyboardEvent.location</code></a>: the location of the key on the device.</li>
-											<li><a href="#events-KeyboardEvent-altKey"><code class="attribute-name">KeyboardEvent.altKey</code></a>: <code>true</code> if <a href="#key-Alt"><code class="key">
-												'Alt'</code></a> modifier was active, otherwise <code>false</code></li>
-											<li><a href="#events-KeyboardEvent-shiftKey"><code class="attribute-name">KeyboardEvent.shiftKey</code></a>:  <code>true</code> if <a href="#key-Shift"><code class="key">
-												'Shift'</code></a> modifier was active, otherwise <code>false</code></li>
-											<li><a href="#events-KeyboardEvent-ctrlKey"><code class="attribute-name">KeyboardEvent.ctrlKey</code></a>:  <code>true</code> if <a href="#key-Control"><code class="key">
-												'Control'</code></a> modifier was active, otherwise <code>false</code></li>
-											<li><a href="#events-KeyboardEvent-metaKey"><code class="attribute-name">KeyboardEvent.metaKey</code></a>:  <code>true</code> if <a href="#key-Meta"><code class="key">
-												'Meta'</code></a> modifier was active, otherwise <code>false</code></li>
-											<li><a href="#events-KeyboardEvent-repeat"><code class="attribute-name">KeyboardEvent.repeat</code></a>:  <code>true</code> if a key has been depressed long enough
-												to trigger key repetition, otherwise <code>false</code></li>
-											<li><a href="#events-KeyboardEvent-locale"><code class="attribute-name">KeyboardEvent.locale</code></a>: the language code for the key event, if available; otherwise,
-												the <a class="def" href="#glossary-empty-string">empty string</a></li>
-										</ul>
-									</td>
-								</tr>
-							</table>
-
-							<p>A <a class="def" href="#glossary-user-agent">user agent</a> MUST dispatch this event when a key is pressed down, if and only if that key normally produces a <a
-								class="def" href="#glossary-character-value">character value</a>. The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event type is device
-								dependent and relies on the capabilities of the input devices and how they are mapped in the operating system. This event type MUST be generated after the <a class="def"
-								href="#glossary-key-mapping">key mapping</a>. It MUST NOT be fired when using an <a class="def" href="#glossary-ime">input method editor</a>.  This event type
-								MUST be dispatched after the <a class="eventtype" href="#event-type-keydown"><code>keydown</code></a> event and before the <a class="eventtype" href="#event-type-keyup">
-								<code>keyup</code></a> event associated with the same key.</p>
-
-							<p class="note"><strong>Note:</strong> The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event is traditionally associated with detecting a
-								<a class="def" href="#glossary-character-value">character value</a> rather than a physical key, and might not be available on all keys in some configurations.</p>
-
-							<p class="warning"><strong>Warning!</strong> The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event type is defined in this
-								specification for reference and completeness, but this specification <a class="def" href="#glossary-deprecated">deprecates</a> the use of this event type. When
-								in editing contexts, authors can subscribe to the "input" event defined in [<cite><a class="informative" href="#references-HTML5">HTML5</a></cite>] instead.</p>
-						</dd>
-					</dl>
-				</div>
-
 				<!-- keyup -->
 				<div class="event-definition">
 					<dl>
@@ -7638,6 +7558,7 @@
 			<h2>Legacy <code>keypress</code> event</h2>
 			<p><em>This section is informative</em></p>
 
+			<!-- keypress -->
 			<div class="event-definition">
 				<dl>
 					<dt id="event-type-keypress"><dfn><a class="eventtype" href="#event-type-keypress"><code>keypress</code></a></dfn></dt>
@@ -7661,7 +7582,7 @@
 							</tr>
 							<tr>
 								<th>Target</th>
-								<td><code>Element</code></td>
+								<td><code>Document</code>, <code>Element</code></td>
 							</tr>
 							<tr>
 								<th>Cancelable</th>
@@ -7669,24 +7590,113 @@
 							</tr>
 							<tr>
 								<th>Default action</th>
-								<td>Insert the character into current editable field.</td>
+								<td>Varies: launch <a class="def" href="#glossary-text-composition-system">text composition system</a>; <a class="eventtype" href="#event-type-blur"><code>blur</code></a>
+									and <a class="eventtype" href="#event-type-focus"><code>focus</code></a> events; <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a>
+									event; other event</td>
 							</tr>
 							<tr>
 								<th>Context info</th>
 								<td>
 									<ul>
-										<li><a href="#events-KeyboardEvent-charCode"><code class="attribute-name">KeyboardEvent.charCode</code></a>: character value for this event</li>
-										<li><a href="#events-KeyboardEvent-keyCode"><code class="attribute-name">KeyboardEvent.keyCode</code></a>: numerical code for this key</li>
-										<li><a href="#events-KeyboardEvent-which"><code class="attribute-name">KeyboardEvent.which</code></a>: numerical code for this key</li>
+										<li><a href="#events-event-type-target"><code class="attribute-name">Event.target</code></a>: focused element processing the key event, root element if no suitable
+											input element focused</li>
+										<li><a href="#events-UIEvent-view"><code class="attribute-name">UIEvent.view</code></a>: <a class="def" href="#glossary-defaultView"><code>defaultView</code></a></li>
+										<li><a href="#events-UIEvent-detail"><code class="attribute-name">UIEvent.detail</code></a>: <code>0</code></li>
+										<li><a href="#events-KeyboardEvent-charCode"><code class="attribute-name">KeyboardEvent.charCode</code></a>: legacy character value for this event</li>
+										<li><a href="#events-KeyboardEvent-keyCode"><code class="attribute-name">KeyboardEvent.keyCode</code></a>: legacy numerical code for this key</li>
+										<li><a href="#events-KeyboardEvent-which"><code class="attribute-name">KeyboardEvent.which</code></a>: legacy numerical code for this key</li>
+										<li><a href="#events-KeyboardEvent-key"><code class="attribute-name">KeyboardEvent.key</code></a>: the key value of the key pressed.</li>
+										<li><a href="#events-KeyboardEvent-location"><code class="attribute-name">KeyboardEvent.location</code></a>: the location of the key on the device.</li>
+										<li><a href="#events-KeyboardEvent-altKey"><code class="attribute-name">KeyboardEvent.altKey</code></a>: <code>true</code> if <a href="#key-Alt"><code class="key">
+											'Alt'</code></a> modifier was active, otherwise <code>false</code></li>
+										<li><a href="#events-KeyboardEvent-shiftKey"><code class="attribute-name">KeyboardEvent.shiftKey</code></a>:  <code>true</code> if <a href="#key-Shift"><code class="key">
+											'Shift'</code></a> modifier was active, otherwise <code>false</code></li>
+										<li><a href="#events-KeyboardEvent-ctrlKey"><code class="attribute-name">KeyboardEvent.ctrlKey</code></a>:  <code>true</code> if <a href="#key-Control"><code class="key">
+											'Control'</code></a> modifier was active, otherwise <code>false</code></li>
+										<li><a href="#events-KeyboardEvent-metaKey"><code class="attribute-name">KeyboardEvent.metaKey</code></a>:  <code>true</code> if <a href="#key-Meta"><code class="key">
+											'Meta'</code></a> modifier was active, otherwise <code>false</code></li>
+										<li><a href="#events-KeyboardEvent-repeat"><code class="attribute-name">KeyboardEvent.repeat</code></a>:  <code>true</code> if a key has been depressed long enough
+											to trigger key repetition, otherwise <code>false</code></li>
+										<li><a href="#events-KeyboardEvent-locale"><code class="attribute-name">KeyboardEvent.locale</code></a>: the language code for the key event, if available; otherwise,
+											the <a class="def" href="#glossary-empty-string">empty string</a></li>
 									</ul>
 								</td>
 							</tr>
 						</table>
 
-						<p>Implementations that support this event MUST dispatch it after the <code>beforeinput</code> event, but before the <code>input</code> event.</p>
+						<p>If supported by a <a class="def" href="#glossary-user-agent">user agent</a>, this event MUST be dispatched when a key is pressed down, if and only if that key normally produces a <a
+							class="def" href="#glossary-character-value">character value</a>. The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event type is device
+							dependent and relies on the capabilities of the input devices and how they are mapped in the operating system. This event type MUST be generated after the <a class="def"
+							href="#glossary-key-mapping">key mapping</a>. It MUST NOT be fired when using an <a class="def" href="#glossary-ime">input method editor</a>.</p>
+
+						<p class="note"><strong>Note:</strong> The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event is traditionally associated with detecting a
+							<a class="def" href="#glossary-character-value">character value</a> rather than a physical key, and might not be available on all keys in some configurations.</p>
+
+						<p class="warning"><strong>Warning!</strong> The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event type is defined in this
+							specification for reference and completeness, but this specification <a class="def" href="#glossary-deprecated">deprecates</a> the use of this event type. When
+							in editing contexts, authors can subscribe to the <code>beforeinput</code> event instead.</p>
+
 					</dd>
 				</dl>
 			</div>
+
+			<section id="keypress-event-order">
+				<h2><code>keypress</code> event order</h2>
+
+				<p>The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event type MUST be dispatched after the
+					<a class="eventtype" href="#event-type-keydown"><code>keydown</code></a> event and before the
+					<a class="eventtype" href="#event-type-keyup"><code>keyup</code></a> event associated with the same key.</p>
+
+				<p>The <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event type MUST be dispatched after the
+					<a class="eventtype" href="#event-type-beforeinput"><code>beforeinput</code></a> event and before the
+					<a class="eventtype" href="#event-type-input"><code>input</code></a> event associated with the same key.</p>
+
+				<p>The sequence of key events for user-agents the support the <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event
+					is demonstrated in the following example:</p>
+
+				<div class="example">
+					<div class="example-title">Example</div>
+					<table class="event-sequence-table">
+						<tr>
+							<td class="cell-right"></td>
+							<th>Event Name</th>
+							<th class="cell-center">KeyboardEvent<br/><code>key</code></th>
+							<th class="cell-center">CompositionEvent<br/><code>data</code></th>
+						</tr>
+						<tr>
+							<td class="cell-right">1.</td>
+							<td><a class="eventtype" href="#event-type-keydown"><code>keydown</code></a></td>
+							<td class="cell-center"><code class="key">'a'</code></td>
+							<td class="cell-center"></td>
+						</tr>
+						<tr>
+							<td class="cell-right">2.</td>
+							<td><a class="eventtype" href="#event-type-beforeinput"><code>beforeinput</code></a></td>
+							<td class="cell-center"></td>
+							<td class="cell-center"><code class="key">'a'</code></td>
+						</tr>
+						<tr>
+							<td class="cell-right">3.</td>
+							<td><a class="eventtype" href="#event-type-keypress"><code>keypress</code></a></td>
+							<td class="cell-center"><code class="key">'a'</code></td>
+							<td class="cell-center"></td>
+						</tr>
+						<tr>
+							<td class="cell-right">4.</td>
+							<td><a class="eventtype" href="#event-type-input"><code>input</code></a></td>
+							<td class="cell-center"></td>
+							<td class="cell-center"></td>
+						</tr>
+						<tr>
+							<td class="cell-right">5.</td>
+							<td><a class="eventtype" href="#event-type-keyup"><code>keyup</code></a></td>
+							<td class="cell-center"><code class="key">'a'</code></td>
+							<td class="cell-center"></td>
+						</tr>
+					</table>
+				</div>
+			</section>
+		
 		</section>
 
 		<section id="legacy-key-models">