<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>25663</bug_id>
          
          <creation_ts>2014-05-12 18:34:18 +0000</creation_ts>
          <short_desc>Make select() work silently on all form controls to which it currently doesn&apos;t apply</short_desc>
          <delta_ts>2017-03-10 05:45:04 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>eoconnor</cc>
    
    <cc>habib.virji</cc>
    
    <cc>hober0</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>jwatt</cc>
    
    <cc>MattN+w3</cc>
    
    <cc>mike</cc>
    
    <cc>mjs</cc>
    
    <cc>mounir</cc>
    
    <cc>ojan</cc>
    
    <cc>rniwa</cc>
    
    <cc>sampo.niskanen</cc>
    
    <cc>stephen.cunliffe</cc>
    
    <cc>tkent</cc>
    
    <cc>travil</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>105741</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-05-12 18:34:18 +0000</bug_when>
    <thetext>It&apos;s been suggested that even on form controls where you can&apos;t normally interact programmatically with the selection (e.g. type=number), it would be useful to have a way to tell the browser to select everything so that when the user starts entering a value, it deletes the previous value.

This could be done in a way that is separate from the rest of the selection API, e.g. no firing &apos;select&apos; events, no selectionStart API, etc.

Any vendors interested in supporting that?

ack Sampo Niskanen from bug 24796.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105824</commentid>
    <comment_count>1</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2014-05-13 10:44:46 +0000</bug_when>
    <thetext>+1. This sounds useful, and implementation cost is low.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106102</commentid>
    <comment_count>2</comment_count>
    <who name="Jonathan Watt">jwatt</who>
    <bug_when>2014-05-15 21:57:47 +0000</bug_when>
    <thetext>yup</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109622</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-30 23:21:09 +0000</bug_when>
    <thetext>Ok, I&apos;ll make select() apply to the following fields:

  Text, Search (already applies)
  URL, Telephone (already applies)
  E-mail
  Password (already applies)
  Date and Time, Date, Month, Week, Time Local Date and Time
  Number
  Colour
  File Upload

For browsers where it makes no sense (e.g. if &quot;Colour&quot; is a colour well, or if &quot;Week&quot; is only a calendar widget) then it&apos;ll just do nothing (not throw, like now).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109705</commentid>
    <comment_count>4</comment_count>
    <who name="">stephen.cunliffe</who>
    <bug_when>2014-07-31 20:41:32 +0000</bug_when>
    <thetext>Awesome. I&apos;m very glad this got reverted. It isn&apos;t quite the full suite of selection properties/methods we need back but it is a start.  Thanks for reconsidering.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111727</commentid>
    <comment_count>5</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-09-17 23:09:05 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8785.
Check-in comment: Add the select() method to input types that might have text fields but where the script-exposed value is unlikely to exactly match the user-exposed value, so that the selection can be switched on, even if it can&apos;t be carefully managed.
https://html5.org/tools/web-apps-tracker?from=8784&amp;to=8785</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112168</commentid>
    <comment_count>6</comment_count>
    <who name="Habib Virji">habib.virji</who>
    <bug_when>2014-09-25 08:53:47 +0000</bug_when>
    <thetext>Contrary to below changes, select() API seem to not throw error in all browsers.

Found following behavior:
1. Chrome, Firefox. IE and Opera do not throw error for select() on all input type (including non text fields, radio, checkbox, button). It does throw error for selection API. 
--&gt; data:text/html,&lt;input type=radio value=&apos;1&apos; id=radio&gt;&lt;script&gt; try { document.getElementById(&apos;radio&apos;).select();} catch(e) {console.log(e); }&lt;/script&gt;

2. On all browsers select() function, selects all text in input type email. 
--&gt; data:text/html,&lt;input type=email value=&apos;ex@example.com&apos; id=email&gt; &lt;script&gt; try { document.getElementById(&apos;email&apos;).select();} catch(e) { console.log(e);}&lt;/script&gt;
3. In Opera and Firefox, selection API() works for input type email. 
--&gt; data:text/html,&lt;input type=email value=&apos;ex@example.com&apos; id=email&gt; &lt;script&gt; try { document.getElementById(&apos;email&apos;).select(); console.log(document.getElementById(&apos;email&apos;).selectionEnd);} catch(e) { console.log(e);}&lt;/script&gt;

4. In Chrome and Opera select(), select all number in input type number. 
--&gt; data:text/html,&lt;input type=number value=2000 id=number&gt; &lt;script&gt; try { document.getElementById(&apos;number&apos;).select();} catch(e) { console.log(e);}&lt;/script&gt;
5. In Opera, selection API works for input type number. 
--&gt; data:text/html,&lt;input type=number value=2000 id=number&gt; &lt;script&gt; try { document.getElementById(&apos;number&apos;).select(); console.log(document.getElementById(&apos;number&apos;).selectionEnd);} catch(e) { console.log(e);}&lt;/script&gt;

6. Firefox allows using selection API on input type date. While Opera and Chrome throws exception.
--&gt; data:text/html,&lt;input type=date value=&quot;2000-10-10&quot; id=date&gt; &lt;script&gt; try { document.getElementById(&apos;date&apos;).select(); console.log(document.getElementById(&apos;date&apos;).selectionEnd);} catch(e) { console.log(e);}&lt;/script&gt;

7. Only Chrome, selects radio, checkbox, file and color element. None of the other browsers does.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>