[webkit-dev] Newline translation issue with textareas
kevin at sb.org
Tue Jun 21 12:00:12 PDT 2005
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";
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
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.
On Jun 20, 2005, at 4:55 PM, Darin Adler wrote:
> On Jun 20, 2005, at 1:25 PM, Kevin Ballard wrote:
>> In terms of actually doing #2, I would suggest that forcing an
>> updateFromElement and then invalidating the cache is the best way
>> to do it, so we don't have the translation happening in 2
>> different places.
> Nah, I think it's OK to have the translation in two different
> places for now. If this was a QString, we'd be talking two lines of
> code here:
> xxx.replace("\r\n", '\n');
> xxx.replace('\r', '\n');
> Lets not bend over too far backwards for this.
kevin at sb.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2378 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/webkit-dev/attachments/20050621/9e791905/smime.bin
More information about the webkit-dev