Closed Bug 404981 Opened 17 years ago Closed 2 years ago

[RFE] Ability to insert/replace text at the textarea selection (like texarea.selectionText = "text")

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: BijuMailList, Unassigned)

Details

Ability to insert/replace text at the textarea selection

needed something simple like
   texarea.selectionText = "Hello,\n\nHow are you today?";

Even though wierd, IE almost have it like
  document.selection.createRange().text = "Hello";

In Firefox currently we have .select(), .selectionStart, .selectionEnd, .setSelectionRange for texarea. 

So to replace current selection text 
* first get content using .value and by slicing at
  .selectionStart, .selectionEnd
* reassign .value after after substituting selection 
  with the string to replace
* .setSelectionRange using appropriate value.

Also we have two bugs which make it troublesome
* Bug 231389 – Textarea scrolls to top after changing its .value, regardless of cursor position
So we need to remember .scrollTop and reapply

* Bug 190147 – Setting the value of a textarea is very slow
This make adding features like autocorrect to textarea slow
Summary: [RFE] Ability to insert/replace text at the textarea selection → [RFE] Ability to insert/replace text at the textarea selection (like texarea.selectionText = "text")

Hi Biju,
Is this issue still relevant for today's latest Firefox versions or should it be closed?

Flags: needinfo?(BijuMailList)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:emilio, since the bug has high severity, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(BijuMailList) → needinfo?(emilio)

These requests should go to the HTML spec.

Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(emilio)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.