[Bug 11745] Feature request: element.replaceSelection(str) for text fields

http://www.w3.org/Bugs/Public/show_bug.cgi?id=11745

Aryeh Gregor <Simetrical+w3cbug@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Aryeh Gregor <Simetrical+w3cbug@gmail.com> 2011-02-15 18:34:38 UTC ---
If there was an API, I wouldn't have filed this bug.  :)  With DOM Range, you
should be able to emulate it pretty easily via deleteContents() and
insertNode(), although that's not specced and I haven't tried it.  But for
textbox/input selections, which are different because their contents aren't in
the DOM, there's no standard API to do this.

Looking back at this issue, though, I'm not sure this is necessary, and if it
is necessary not sure it'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's not the right
approach, I don't think it actually makes sense to tie this to the user's
selection -- maybe you want to replace some slice for some other reason.

So I'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's the
best way to solve the problem.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 15 February 2011 18:34:41 UTC