[webkit-dev] Newline translation issue with textareas
Darin Adler
darin at apple.com
Tue Jun 21 15:02:11 PDT 2005
On Jun 21, 2005, at 12:00 PM, Kevin Ballard wrote:
> Well, I just ran into another problem with doing it this way.
>
> If I have an empty textarea, and I run the following code:
>
> var elt = document.getElementById("foo"); // foo is the textarea
> elt.value = "This is a test";
> elt.setSelectionRange(3,5);
> alert(elt.selectionStart);
>
> I end up getting 0 back, because the value hasn't been pushed down
> to the KWQTextArea yet, but that's where the selection is, which
> means I'm setting the selection while KWQTextArea still has an
> empty value.
>
> So there's 2 solutions to this:
>
> 1) Cache the selection up in the HTMLTextAreaElementImpl as well
> 2) Push the text value down to KWQTextArea on
> HTMLTextAreaElementImpl::setValue().
>
> I don't think option #1 is really necessary, it would just cause
> more syncing issues, so I'd suggest going with #2. Is there any
> problem with calling updateFromElement() after setting the text value?
>
> I also suspect that HTMLInputElementImpl will have the same
> problem, but I haven't actually tested yet.
Sounds fine. Lets see how well it works.
-- Darin
More information about the webkit-dev
mailing list