<?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>11745</bug_id>
          
          <creation_ts>2011-01-13 00:23:57 +0000</creation_ts>
          <short_desc>Feature request: element.replaceSelection(str) for text fields</short_desc>
          <delta_ts>2011-08-04 05:03:37 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#textFieldSelection</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ayg</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>44313</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-01-13 00:23:57 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html
Section: http://www.whatwg.org/specs/web-apps/current-work/#textFieldSelection

Comment:
Feature request: element.replaceSelection(str) should change the text field&apos;s
value by replacing the current selection with the provided string, which
should then be the new selection.  This is apparently supported well in IE&apos;s
proprietary equivalent, and a MediaWiki developer pointed it out as one of the
significant problems he ran into with the standard approach:
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/User:Catrope/W3C_Range_f
eature_requests#Changing_the_text_contents_of_a_range I think this is simple
enough to spec before implementation, if implementers are interested, to avoid
the whole vendor prefix rigamarole.

Posted from: 68.175.61.233</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45512</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-02-15 00:26:43 +0000</bug_when>
    <thetext>Aryeh: Is there an API for this kind of thing already, by any chance?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45622</commentid>
    <comment_count>2</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-02-15 18:34:38 +0000</bug_when>
    <thetext>If there was an API, I wouldn&apos;t have filed this bug.  :)  With DOM Range, you should be able to emulate it pretty easily via deleteContents() and insertNode(), although that&apos;s not specced and I haven&apos;t tried it.  But for textbox/input selections, which are different because their contents aren&apos;t in the DOM, there&apos;s no standard API to do this.

Looking back at this issue, though, I&apos;m not sure this is necessary, and if it is necessary not sure it&apos;s the right way to fix it.  Browsers could make it more efficient as it stands, namely make

input.value = input.value.substr(0, input.selectionStart) + someText + input.value.substr(input.selectionEnd);

more efficient somehow for large input values.  And if that&apos;s not the right approach, I don&apos;t think it actually makes sense to tie this to the user&apos;s selection -- maybe you want to replace some slice for some other reason.

So I&apos;m going to resolve INVALID, on reflection.  We probably have better things to do.  If there are performance problems with existing browsers, bugs should be filed on them, and we can consider new features if they think that&apos;s the best way to solve the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52683</commentid>
    <comment_count>3</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:03:37 +0000</bug_when>
    <thetext>mass-moved component to LC1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>