ACTION-64: Consider using string values instead of constants. re: warning at http://www.w3.org/TR/WebIDL/#idl-constants
authorJames Craig <jcraig@apple.com>
Sun, 18 Aug 2013 02:04:30 -0700
changeset 129 26392d0a621b
parent 128 069a953b1148
child 130 25604abde240
ACTION-64: Consider using string values instead of constants. re: warning at http://www.w3.org/TR/WebIDL/#idl-constants
src/indie-ui-events.html
--- a/src/indie-ui-events.html	Sun Aug 18 01:19:56 2013 -0700
+++ b/src/indie-ui-events.html	Sun Aug 18 02:04:30 2013 -0700
@@ -405,24 +405,7 @@
 
 				<dl title="[Constructor(DOMString typeArg, optional UIFocusRequestEventInit dictUIFocusRequestEventInit)] interface UIFocusRequestEvent : UIRequestEvent" class="idl">
 
-					<dt>const unsigned short UNKNOWN = 0</dt><dd></dd>
-
-					<dt>const unsigned short NAV_FIRST = 1</dt><dd></dd>
-					<dt>const unsigned short NAV_PREV  = 2</dt><dd></dd>
-					<dt>const unsigned short NAV_NEXT  = 3</dt><dd></dd>
-					<dt>const unsigned short NAV_LAST  = 4</dt><dd></dd>
-
-					<!-- clockwise from top -->
-					<dt>const unsigned short NAV_UP         = 5</dt><dd></dd>
-					<dt>const unsigned short NAV_UP_RIGHT   = 6</dt><dd></dd>
-					<dt>const unsigned short NAV_RIGHT      = 7</dt><dd></dd>
-					<dt>const unsigned short NAV_DOWN_RIGHT = 8</dt><dd></dd>
-					<dt>const unsigned short NAV_DOWN       = 9</dt><dd></dd>
-					<dt>const unsigned short NAV_DOWN_LEFT  = 10</dt><dd></dd>
-					<dt>const unsigned short NAV_LEFT       = 11</dt><dd></dd>
-					<dt>const unsigned short NAV_UP_LEFT    = 12</dt><dd></dd>
-
-					<dt>readonly attribute unsigned short focusType</dt><dd></dd>
+					<dt>readonly attribute DOMString focusType</dt><dd></dd>
 					
 				</dl>
 				
@@ -443,36 +426,28 @@
 						<dt>EventTarget receiver = null</dt><dd></dd>
 
 						<!-- Attributes from UIFocusRequestEventInit -->
-						<dt>unsigned short focusType = 0</dt><dd>Type of linear or directional focus requested, as defined in the interface constants. Defaults to 0 (UNKNOWN). <!-- <p class="ednote">TBD whether this will be constants in the constructor, or in the LinearFocusType and DirectionalFocusType dictionaries. Both are defined here during consideration.</p> --></dd>
+						<dt>DOMString? focusType = null</dt>
+						<dd>
+							<p>Type of linear or directional focus requested, as defined below. Value remains null except when used for directionalfocusrequest or linearfocusrequest.</p>
+							<p class="ednote">Note: We may need to defined these "constant" string values elsewhere in the IDL.</p>
+							<ul>
+								<li><code>"NAV_FIRST"</code>: linear first</li>
+								<li><code>"NAV_PREV"</code>: linear previous</li>
+								<li><code>"NAV_NEXT"</code>: linear next</li>
+								<li><code>"NAV_LAST"</code>: linear last</li>
+								<li><code>"NAV_UP"</code>: directional "North"</li>
+								<li><code>"NAV_UP_RIGHT"</code>: directional "Northeast"</li>
+								<li><code>"NAV_RIGHT"</code>: directional "East"</li>
+								<li><code>"NAV_DOWN_RIGHT"</code>: directional "Southeast"</li>
+								<li><code>"NAV_DOWN"</code>: directional "South"</li>
+								<li><code>"NAV_DOWN_LEFT"</code>: directional "Southwest"</li>
+								<li><code>"NAV_LEFT"</code>: directional "West"</li>
+								<li><code>"NAV_UP_LEFT"</code>: directional "Northwest"</li>
+							</ul>
+						</dd>
 
 					</dl>
 				</section>
-
-				<!--
-				<section id="FocusTypeValues">
-					<h5>FocusType Values</h5>
-					<p class="ednote">TBD: These NAV_* constants could also be defined as constants. See above.</p>
-						
-					<dl title="dictionary LinearFocusType" class="idl">
-						<dt>const unsigned short NAV_FIRST = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_PREV  = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_NEXT  = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_LAST  = TBD</dt><dd></dd>
-					</dl>
-
-					<dl title="dictionary DirectionalFocusType" class="idl">
-						<dt>const unsigned short NAV_UP         = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_UP_LEFT    = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_LEFT       = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_DOWN_LEFT  = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_DOWN       = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_DOWN_RIGHT = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_RIGHT      = TBD</dt><dd></dd>
-						<dt>const unsigned short NAV_UP_RIGHT   = TBD</dt><dd></dd>
-					</dl>
-
-				</section>
-				-->
 				
 				<section id="UIFocusRequestEvents">
 					<h4>UIFocusRequestEvent Types</h4>
@@ -486,7 +461,7 @@
 							<ul>
 								<li>Bubbles: Yes</li>
 								<li>Cancelable: Yes</li>
-								<li>Context Info: <code>focusType</code> (one of directional focus constants)</li>
+								<li>Context Info: <code>focusType</code> (one of directional focusType string)</li>
 							</ul>
 						</dd>
 
@@ -496,7 +471,7 @@
 							<ul>
 								<li>Bubbles: Yes</li>
 								<li>Cancelable: Yes</li>
-								<li>Context Info: <code>focusType</code> (one of linear focus constants)</li>
+								<li>Context Info: <code>focusType</code> (one of linear focusType strings)</li>
 							</ul>
 						</dd>
 
@@ -686,25 +661,9 @@
 				<h3>Interface UIScrollRequestEvent</h3>
 				<dl title="[Constructor(DOMString typeArg, optional UIScrollRequestEventInit dictUIScrollRequestEventInit)] interface UIScrollRequestEvent : UIRequestEvent" class="idl">
 					
-					<dt>const unsigned short DELTAS = 0</dt><dd>Default value for scrollType indicating that scroll amount is provided as deltaX and deltaY in CSS pixels.</dd>
-					
-					<!-- clockwise from top -->
-					<dt>const unsigned short UP          = 1</dt><dd>Equivalent to the default behavior of the <kbd>UP</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short RIGHT       = 2</dt><dd>Equivalent to the default behavior of the <kbd>RIGHT</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short DOWN        = 3</dt><dd>Equivalent to the default behavior of the <kbd>DOWN</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short LEFT        = 4</dt><dd>Equivalent to the default behavior of the <kbd>LEFT</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short PAGE_UP     = 5</dt><dd>Equivalent to the default behavior of the <kbd>PAGEUP</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short PAGE_RIGHT  = 6</dt><dd></dd>
-					<dt>const unsigned short PAGE_DOWN   = 7</dt><dd>Equivalent to the default behavior of the <kbd>PAGEDOWN</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short PAGE_LEFT   = 8</dt><dd></dd>
-					<dt>const unsigned short LIMIT_UP    = 9</dt><dd>Equivalent to the default behavior of the <kbd>HOME</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short LIMIT_RIGHT = 10</dt><dd></dd>
-					<dt>const unsigned short LIMIT_DOWN  = 11</dt><dd>Equivalent to the default behavior of the <kbd>END</kbd> key in most native scroll views.</dd>
-					<dt>const unsigned short LIMIT_LEFT  = 12</dt><dd></dd>
-
 					<dt>readonly attribute double? deltaX</dt><dd> </dd>
 					<dt>readonly attribute double? deltaY</dt><dd> </dd>
-					<dt>readonly attribute unsigned short scrollType</dt><dd></dd>
+					<dt>readonly attribute DOMString scrollType</dt><dd></dd>
 
 				</dl>
 				
@@ -726,7 +685,27 @@
 						<!-- Attributes from UIScrollRequestEventInit  -->
 						<dt>optional double? deltaX = 0.0</dt><dd>The cartesian X coordinate delta, in CSS pixels.</dd>
 						<dt>optional double? deltaY = 0.0</dt><dd>The cartesian Y coordinate delta, in CSS pixels.</dd>
-						<dt>unsigned short scrollType = 0</dt><dd>Type of scroll requested, as defined in the interface constants. Defaults to 0 (DELTAS) which indicates deltas are provided.</dd>
+
+						<dt>DOMString? scrollType = "DELTAS"</dt>
+						<dd>
+							<p>Type of scroll requested, as defined below.</p>
+							<p class="ednote">Note: We may need to defined these "constant" string values elsewhere in the IDL.</p>
+							<ul>
+								<li><code>"DELTAS"</code>: Default value for scrollType indicating that scroll amount is provided as deltaX and deltaY in CSS pixels.</li>
+								<li><code>"UP"</code>: Equivalent to the default behavior of the <kbd>UP</kbd> key in most native scroll views.</li>
+								<li><code>"RIGHT"</code>: Equivalent to the default behavior of the <kbd>RIGHT</kbd> key in most native scroll views.</li>
+								<li><code>"DOWN"</code>: Equivalent to the default behavior of the <kbd>DOWN</kbd> key in most native scroll views.</li>
+								<li><code>"LEFT"</code>: Equivalent to the default behavior of the <kbd>LEFT</kbd> key in most native scroll views.</li>
+								<li><code>"PAGE_UP"</code>: Equivalent to the default behavior of the <kbd>PAGEUP</kbd> key in most native scroll views.</li>
+								<li><code>"PAGE_RIGHT"</code>: </li>
+								<li><code>"PAGE_DOWN"</code>: Equivalent to the default behavior of the <kbd>PAGEDOWN</kbd> key in most native scroll views.</li>
+								<li><code>"PAGE_LEFT"</code>: </li>
+								<li><code>"LIMIT_UP"</code>: Equivalent to the default behavior of the <kbd>HOME</kbd> key in most native scroll views.</li>
+								<li><code>"LIMIT_RIGHT"</code>: </li>
+								<li><code>"LIMIT_DOWN"</code>: Equivalent to the default behavior of the <kbd>END</kbd> key in most native scroll views.</li>
+								<li><code>"LIMIT_LEFT"</code>: </li>
+							</ul>
+						</dd>
 
 					</dl>
 				</section>
@@ -754,19 +733,7 @@
 			<section id="UIValueChangeRequestEvent" class="normative">
 				<h3>Interface UIValueChangeRequestEvent</h3>
 				<dl title="[Constructor(DOMString typeArg, optional UIValueChangeRequestEventInit dictUIValueChangeRequestEventInit)] interface UIValueChangeRequestEvent : UIRequestEvent" class="idl">
-					
-					<dt>const unsigned short UNKNOWN         = 0</dt><dd></dd>
-					<dt>const unsigned short INCREMENT       = 1</dt><dd>Equivalent to the default behavior of the <kbd>UP</kbd> key on most native sliders.</dd>
-					<dt>const unsigned short INCREMENT_SMALL = 2</dt><dd>Equivalent to the behavior of <kbd>ALT+UP</kbd> or <kbd>OPTION+UP</kbd> on some native controls, indicating a finely tuned adjustment (e.g. +0.1% as opposed to +1%).</dd>
-					<dt>const unsigned short INCREMENT_LARGE = 3</dt><dd>Equivalent to the default behavior of <kbd>PAGEUP</kbd> or <kbd>SHIFT+UP</kbd> on many native sliders.</dd>
-					<dt>const unsigned short INCREMENT_MAX   = 4</dt><dd>Equivalent to the default behavior of the <kbd>END</kbd> key on most native sliders.</dd>
-					<dt>const unsigned short DECREMENT       = 5</dt><dd>Equivalent to the default behavior of the <kbd>DOWN</kbd> key on most native sliders.</dd>
-					<dt>const unsigned short DECREMENT_SMALL = 6</dt><dd>Equivalent to the behavior of <kbd>ALT+DOWN</kbd> or <kbd>OPTION+DOWN</kbd> on some native controls, indicating a finely tuned adjustment (e.g. -0.1% as opposed to -1%).</dd>
-					<dt>const unsigned short DECREMENT_LARGE = 7</dt><dd>Equivalent to the default behavior of <kbd>PAGEDOWN</kbd> or <kbd>SHIFT+DOWN</kbd> on many native sliders.</dd>
-					<dt>const unsigned short DECREMENT_MIN   = 8</dt><dd>Equivalent to the default behavior of the <kbd>HOME</kbd> key on most native sliders.</dd>
-
-					<dt>readonly attribute unsigned short changeType</dt><dd></dd>
-
+					<dt>readonly attribute DOMString changeType</dt><dd></dd>
 				</dl>
 				
 				<section id="UIValueChangeRequestEventInit">
@@ -785,7 +752,21 @@
 						<dt>EventTarget receiver = null</dt><dd></dd>
 
 						<!-- Attributes from UIValueChangeRequestEventInit  -->
-						<dt>unsigned short changeType = 0</dt><dd>Type of change requested, as defined in the interface constants. Defaults to 0 (UNKNOWN).</dd>
+						<dt>DOMString? changeType = null</dt>
+						<dd>
+							<p>Type of change requested, as defined below.</p>
+							<p class="ednote">Note: We may need to defined these "constant" string values elsewhere in the IDL.</p>
+							<ul>
+								<li><code>"INCREMENT"</code>: Equivalent to the default behavior of the <kbd>UP</kbd> key on most native sliders.</li>
+								<li><code>"INCREMENT_SMALL"</code>: Equivalent to the behavior of <kbd>ALT+UP</kbd> or <kbd>OPTION+UP</kbd> on some native controls, indicating a finely tuned adjustment (e.g. +0.1% as opposed to +1%).</li>
+								<li><code>"INCREMENT_LARGE"</code>: Equivalent to the default behavior of <kbd>PAGEUP</kbd> or <kbd>SHIFT+UP</kbd> on many native sliders.</li>
+								<li><code>"INCREMENT_MAX"</code>: Equivalent to the default behavior of the <kbd>END</kbd> key on most native sliders.</li>
+								<li><code>"DECREMENT"</code>: Equivalent to the default behavior of the <kbd>DOWN</kbd> key on most native sliders.</li>
+								<li><code>"DECREMENT_SMALL"</code>: Equivalent to the behavior of <kbd>ALT+DOWN</kbd> or <kbd>OPTION+DOWN</kbd> on some native controls, indicating a finely tuned adjustment (e.g. -0.1% as opposed to -1%).</li>
+								<li><code>"DECREMENT_LARGE"</code>: Equivalent to the default behavior of <kbd>PAGEDOWN</kbd> or <kbd>SHIFT+DOWN</kbd> on many native sliders.</li>
+								<li><code>"DECREMENT_MIN"</code>: Equivalent to the default behavior of the <kbd>HOME</kbd> key on most native sliders.</li>
+							</ul>
+						</dd>
 
 					</dl>
 				</section>