HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/6060

SVNBugCommentTime (UTC)
6060[Gecko] [Internet Explorer] [Opera] [Webkit] Add input.selectionDirection and textarea.selectionDirection, to allow authors to save the direction of the selection.2011-05-03 23:49
Index: source
===================================================================
--- source	(revision 6059)
+++ source	(revision 6060)
@@ -46539,7 +46539,8 @@
   void <span title="dom-textarea/input-select">select</span>();
            attribute unsigned long <span title="dom-textarea/input-selectionStart">selectionStart</span>;
            attribute unsigned long <span title="dom-textarea/input-selectionEnd">selectionEnd</span>;
-  void <span title="dom-textarea/input-setSelectionRange">setSelectionRange</span>(in unsigned long start, in unsigned long end);
+           attribute DOMString <span title="dom-textarea/input-selectionDirection">selectionDirection</span>;
+  void <span title="dom-textarea/input-setSelectionRange">setSelectionRange</span>(in unsigned long start, in unsigned long end, in optional DOMString direction);
 };</pre>
    </dd>
   </dl>
@@ -46714,8 +46715,9 @@
   title="dom-input-selectedOption">selectedOption</code> IDL
   attributes, the <code
   title="dom-textarea/input-select">select()</code> method, the <code
-  title="dom-textarea/input-selectionStart">selectionStart</code> and
-  <code title="dom-textarea/input-selectionEnd">selectionEnd</code>
+  title="dom-textarea/input-selectionStart">selectionStart</code>,
+  <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+  <code title="dom-textarea/input-selectionDirection">selectionDirection</code>,
   IDL attributes, the <code
   title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
   method, the <code title="dom-input-stepUp">stepUp()</code> and
@@ -47615,6 +47617,31 @@
 <!-- <td class="no"> &middot;      Button -->
 
     <tr>
+     <th> <code title="dom-textarea/input-selectionDirection">selectionDirection</code>
+     <td class="no"> &middot; <!-- Hidden -->
+     <td class="yes"> Yes     <!-- Text -->
+<!-- <td class="yes"> Yes          Search -->
+     <td class="yes"> Yes     <!-- URL, Telephone -->
+     <td class="no"> &middot; <!-- E-mail -->
+     <td class="yes"> Yes     <!-- Password -->
+     <td class="no"> &middot; <!-- Date and Time -->
+<!-- <td class="no"> &middot;      Date -->
+<!-- <td class="no"> &middot;      Month -->
+<!-- <td class="no"> &middot;      Week -->
+<!-- <td class="no"> &middot;      Time -->
+     <td class="no"> &middot; <!-- Local Date and Time -->
+<!-- <td class="no"> &middot;      Number -->
+     <td class="no"> &middot; <!-- Range -->
+     <td class="no"> &middot; <!-- Color -->
+     <td class="no"> &middot; <!-- Checkbox -->
+<!-- <td class="no"> &middot;      Radio Button -->
+     <td class="no"> &middot; <!-- File Upload -->
+     <td class="no"> &middot; <!-- Submit Button -->
+     <td class="no"> &middot; <!-- Image Button -->
+     <td class="no"> &middot; <!-- Reset Button -->
+<!-- <td class="no"> &middot;      Button -->
+
+    <tr>
      <th> <code title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
      <td class="no"> &middot; <!-- Hidden -->
      <td class="yes"> Yes     <!-- Text -->
@@ -48018,6 +48045,7 @@
   title="dom-textarea/input-select">select()</code>, <code
   title="dom-textarea/input-selectionStart">selectionStart</code>,
   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+  <code title="dom-textarea/input-selectionDirection">selectionDirection</code>,
   and <code
   title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
   methods and attributes expose the element's text selection. The
@@ -48106,6 +48134,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -48210,7 +48239,8 @@
    <code title="dom-input-list">list</code>,
    <code title="dom-input-selectedOption">selectedOption</code>,
    <code title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, 
+   <code title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code title="dom-input-value">value</code> IDL attributes;
    <code title="dom-textarea/input-select">select()</code> and
    <code title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -48318,7 +48348,8 @@
    <code title="dom-input-list">list</code>,
    <code title="dom-input-selectedOption">selectedOption</code>,
    <code title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, 
+   <code title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code title="dom-input-value">value</code> IDL attributes;
    <code title="dom-textarea/input-select">select()</code> and
    <code title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -48430,7 +48461,8 @@
    <code title="dom-input-list">list</code>,
    <code title="dom-input-selectedOption">selectedOption</code>,
    <code title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code title="dom-input-value">value</code> IDL attributes;
    <code title="dom-textarea/input-select">select()</code> and
    <code title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -48768,6 +48800,7 @@
    <code class="no-backref" title="dom-input-files">files</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -48828,7 +48861,8 @@
    <code title="attr-input-required">required</code>, and
    <code title="attr-input-size">size</code> content attributes;
    <code title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code title="dom-input-value">value</code> IDL attributes;
    <code title="dom-textarea/input-select">select()</code>, and
    <code title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -49051,8 +49085,9 @@
    element:
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>, and
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code> IDL attributes;
+   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
 
@@ -49246,8 +49281,9 @@
    <p>The following IDL attributes and methods do not apply to the
    element:
    <code class="no-backref" title="dom-input-checked">checked</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>, and
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code> IDL attributes;
+   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
 
@@ -49421,8 +49457,9 @@
    element:
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>, and
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code> IDL attributes;
+   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
 
@@ -49598,8 +49635,9 @@
    element:
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>, and
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code> IDL attributes;
+   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
 
@@ -49772,8 +49810,9 @@
    element:
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>, and
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code> IDL attributes;
+   <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
 
@@ -49930,7 +49969,8 @@
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -50104,7 +50144,8 @@
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -50296,7 +50337,8 @@
    <code class="no-backref" title="dom-input-checked">checked</code>,
    <code class="no-backref" title="dom-input-files">files</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
-   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>, and
+   <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>, and
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code> and
    <code class="no-backref" title="dom-textarea/input-setSelectionRange">setSelectionRange()</code> methods.</p>
@@ -50464,6 +50506,7 @@
    <code class="no-backref" title="dom-input-files">files</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -50588,6 +50631,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -50744,6 +50788,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -50950,6 +50995,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -51053,6 +51099,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -51330,6 +51377,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -51425,6 +51473,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -51511,6 +51560,7 @@
    <code class="no-backref" title="dom-input-selectedOption">selectedOption</code>,
    <code class="no-backref" title="dom-textarea/input-selectionStart">selectionStart</code>,
    <code class="no-backref" title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+   <code class="no-backref" title="dom-textarea/input-selectionDirection">selectionDirection</code>,
    <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code>, and
    <code class="no-backref" title="dom-input-valueAsNumber">valueAsNumber</code> IDL attributes;
    <code class="no-backref" title="dom-textarea/input-select">select()</code>,
@@ -54139,7 +54189,8 @@
   void <span title="dom-textarea/input-select">select</span>();
            attribute unsigned long <span title="dom-textarea/input-selectionStart">selectionStart</span>;
            attribute unsigned long <span title="dom-textarea/input-selectionEnd">selectionEnd</span>;
-  void <span title="dom-textarea/input-setSelectionRange">setSelectionRange</span>(in unsigned long start, in unsigned long end);
+           attribute DOMString <span title="dom-textarea/input-selectionDirection">selectionDirection</span>;
+  void <span title="dom-textarea/input-setSelectionRange">setSelectionRange</span>(in unsigned long start, in unsigned long end, in optional DOMString direction);
 };</pre>
    </dd>
   </dl>
@@ -54498,6 +54549,7 @@
   title="dom-textarea/input-select">select()</code>, <code
   title="dom-textarea/input-selectionStart">selectionStart</code>,
   <code title="dom-textarea/input-selectionEnd">selectionEnd</code>,
+  <code title="dom-textarea/input-selectionDirection">selectionDirection</code>,
   and <code
   title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
   methods and attributes expose the element's text selection. The
@@ -56300,7 +56352,8 @@
   <pre class="idl extract">  void <span title="dom-textarea/input-select">select</span>();
            attribute unsigned long <span title="dom-textarea/input-selectionStart">selectionStart</span>;
            attribute unsigned long <span title="dom-textarea/input-selectionEnd">selectionEnd</span>;
-  void <span title="dom-textarea/input-setSelectionRange">setSelectionRange</span>(in unsigned long start, in unsigned long end);</pre>
+           attribute DOMString <span title="dom-textarea/input-selectionDirection">selectionDirection</span>;
+  void <span title="dom-textarea/input-setSelectionRange">setSelectionRange</span>(in unsigned long start, in unsigned long end, in optional DOMString direction);</pre>
   <!-- v2: also add textLength? it seems to be widely used -->
 
   <p>These methods and attributes expose and control the selection of
@@ -56336,14 +56389,26 @@
 
    </dd>
 
-   <dt><var title="">element</var> . <code title="dom-textarea/input-setSelectionRange">setSelectionRange</code>(<var title="">start</var>, <var title="">end</var>)</dt>
+   <dt><var title="">element</var> . <code title="dom-textarea/input-selecionDirection">selectionDirection</code> [ = <var title="">value</var> ]</dt>
 
    <dd>
 
-    <p>Changes the selection to cover the given substring.</p>
+    <p>Returns the current direction of the selection.</p>
 
+    <p>Can be set, to change the direction of the selection.</p>
+
+    <p>The possible values are "<code title="">forward</code>", "<code title="">backward</code>", and "<code title="">none</code>".</p>
+
    </dd>
 
+   <dt><var title="">element</var> . <code title="dom-textarea/input-setSelectionRange">setSelectionRange</code>(<var title="">start</var>, <var title="">end</var> [, <var title="">direction</var>] )</dt>
+
+   <dd>
+
+    <p>Changes the selection to cover the given substring in the given direction. If the direction is omitted, it will be reset to be the platform default (none or forward).</p>
+
+   </dd>
+
   </dl>
 
   <div class="impl">
@@ -56359,10 +56424,35 @@
   elements, these methods and attributes must operate on the element's
   <span title="concept-textarea-raw-value">raw value</span>.</p>
 
+  <p>The selections of <code>input</code> and <code>textarea</code>
+  elements have a <i>direction</i>, which is either <i>forward</i>,
+  <i>backward</i>, or <i>none</i>. This direction is set when the user
+  manipulates the selection. The exact meaning of the selection
+  direction depends on the platform.</p>
+
+  <p class="note">On Windows, the direction indicates the position of
+  the caret relative to the selection: a <i>forward</i> selection has
+  the caret at the end of the selection and a <i>backward</i>
+  selection has the caret at the start of the selection. Windows has
+  no <i>none</i> direction. On Mac, the direction indicates which end
+  of the selection is affected when the user adjusts the size of the
+  selection using the arrow keys with the Shift modifier: the forward
+  direction means the end of the selection is modified, and the
+  backwards direction means the start of the selection is modified.
+  The none direction is the default on Mac, it indicates that no
+  particular direction has yet been selected. The user sets the
+  direction implicitly when first adjusting the selection, based on
+  which directional arrow key was used.</p>
+
+
   <p>The <dfn
   title="dom-textarea/input-select"><code>select()</code></dfn> method
-  must cause the contents of the text field to be fully selected.</p>
+  must cause the contents of the text field to be fully selected, with
+  the selection direction being none, if the platform support
+  selections with the direction <i>none</i>, or otherwise
+  <i>forward</i>.</p>
 
+
   <p>The <dfn
   title="dom-textarea/input-selectionStart"><code>selectionStart</code></dfn>
   attribute must, on getting, return the offset (in logical order) to
@@ -56373,14 +56463,17 @@
 
   <p>On setting, it must act as if the <code
   title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
-  method had been called, with the new value as the first argument,
-  and the current value of the <code
+  method had been called, with the new value as the first argument;
+  the current value of the <code
   title="dom-textarea/input-selectionEnd">selectionEnd</code>
   attribute as the second argument, unless the current value of the
   <code title="dom-textarea/input-selectionEnd">selectionEnd</code> is
   less than the new value, in which case the second argument must also
-  be the new value.</p>
+  be the new value; and the current value of the <code
+  title="dom-textarea/input-selectionDirection">selectionDirection</code>
+  as the third argument.</p>
 
+
   <p>The <dfn
   title="dom-textarea/input-selectionEnd"><code>selectionEnd</code></dfn>
   attribute must, on getting, return the offset (in logical order) to
@@ -56393,16 +56486,37 @@
   title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
   method had been called, with the current value of the <code
   title="dom-textarea/input-selectionStart">selectionStart</code>
-  attribute as the first argument, and new value as the second
+  attribute as the first argument, the new value as the second
+  argument, and the current value of the <code
+  title="dom-textarea/input-selectionDirection">selectionDirection</code>
+  as the third argument.</p>
+
+
+  <p>The <dfn
+  title="dom-textarea/input-selectionDirection"><code>selectionDirection</code></dfn>
+  attribute must, on getting, return the string corresponding to the
+  current selection direction: if the direction is <i>forward</i>,
+  "<code title="">forward</code>"; if the direction is
+  <i>backward</i>, "<code title="">backward</code>"; and otherwise,
+  "<code title="">none</code>".</p>
+
+  <p>On setting, it must act as if the <code
+  title="dom-textarea/input-setSelectionRange">setSelectionRange()</code>
+  method had been called, with the current value of the <code
+  title="dom-textarea/input-selectionStart">selectionStart</code>
+  attribute as the first argument, the current value of the <code
+  title="dom-textarea/input-selectionEnd">selectionEnd</code>
+  attribute as the first argument, and the new value as the third
   argument.</p>
 
+
   <p>The <dfn
   title="dom-textarea/input-setSelectionRange"><code>setSelectionRange(<var
-  title="">start</var>, <var title="">end</var>)</code></dfn> method
-  must set the selection of the text field to the sequence of
-  characters starting with the character at the <var
-  title="">start</var>th position (in logical order) and ending with
-  the character at the <span title="">(<var
+  title="">start</var>, <var title="">end</var>, <var
+  title="">direction</var>)</code></dfn> method must set the selection
+  of the text field to the sequence of characters starting with the
+  character at the <var title="">start</var>th position (in logical
+  order) and ending with the character at the <span title="">(<var
   title="">end</var>-1)</span>th position. Arguments greater than the
   length of the value in the text field must be treated as pointing at
   the end of the text field. If <var title="">end</var> is less than
@@ -56411,8 +56525,16 @@
   immediately before the character with offset <var
   title="">end</var>. In UAs where there is no concept of an empty
   selection, this must set the cursor to be just before the character
-  with offset <var title="">end</var>.</p>
+  with offset <var title="">end</var>. The direction of the selection
+  must be set to <i>backward</i> if <var title="">direction</var> is a
+  <span>case-sensitive</span> match for the string "<code
+  title="">backward</code>", <i>forward</i> if <var
+  title="">direction</var> is a <span>case-sensitive</span> match for
+  the string "<code title="">forward</code>" or if the platform does
+  not support selections with the direction <i>none</i>, and
+  <i>none</i> otherwise (including if the argument is omitted).</p>
 
+
   <p>All elements to which this API applies have either a selection or
   a text entry cursor position at all times (even for elements that
   are not <span>being rendered</span>). User agents should follow
@@ -56420,6 +56542,11 @@
 
   </div>
 
+  <p>Characters with no visible rendering, such as U+200D ZERO WIDTH
+  JOINER, still count as characters. Thus, for instance, the selection
+  can include just an invisible character, and the text insertion
+  cursor can be placed to one side or another of such a character.</p>
+
   <div class="example">
 
    <p>To obtain the currently selected text, the following JavaScript
@@ -56432,13 +56559,26 @@
 
   </div>
 
-  <p>Characters with no visible rendering, such as U+200D ZERO WIDTH
-  JOINER, still count as characters. Thus, for instance, the selection
-  can include just an invisible character, and the text insertion
-  cursor can be placed to one side or another of such a character.</p>
+  <div class="example">
 
+   <p>To add some text at the start of a text control, while
+   maintaining the text selection, the three attributes must be
+   preserved:</p>
 
+   <pre>var oldStart = control.selectionStart;
+var oldEnd = control.selectionEnd;
+var oldDirection = control.selectionDirection;
+var prefix = "http://";
+control.value = prefix + control.value;
+control.setSelectionRange(oldStart + prefix.length, oldEnd + prefix.length, oldDirection);</pre>
 
+   <p>...where <var title="">control</var> is the <code>input</code>
+   or <code>textarea</code> element.</p>
+
+  </div>
+
+
+
   <h4>Constraints</h4>
 
   <h5>Definitions</h5>

|