Re: set input.value when input element has composition string

Hello Makoto,
(Cc+ public-webapps)

(11/02/25 15:16), Makoto Kato wrote:
> Hi,
>
> This is simple sample.  This behavior is different on all web browsers
> when input element has composition/preedit string for IME.

A relevant question here, I think, is where the cursor should go when
the value of the text box is set by script. For Safari5, it always goes
to the end when the value is set. For FF4.0b11, the cursor stays in
previous position when the value to be set is the same and goes to the
end when the value is different. Is this a known incompatibility? I find
the behavior of FF quite strange.

>
> If input element has composition string by IME, should it cancel
> composition string and set value by script?  Or should it cancel
> setting value since it has composition string?

What makes sense to me is:
1. the cursor always goes to the end
2. the composition string goes with the cursor, which should not change.

But I am not sure whether this is the right way to go.

Cheers,
Kenny
>
>
> <script>
> function setvalue() {
>   document.getElementById('test').value = "replaced";
> }
> </script>
> <body onload="setTimeout('setvalue()',5000)">
> <input type="text" id="test"/>
> </body>
>
>
> -- Makoto Kato
>
>

Received on Monday, 28 February 2011 12:30:50 UTC