On Wed, 07 May 2008 17:13:12 +0200, Olli Pettay <[EMAIL PROTECTED]> wrote:
There are two types of key events: * Hardware reference events.
* Text insertion events. The keypress and textInput events include complete information about the character the input is generating, if any, taking into account shift states, previous dead keys and other contextual information required to decide what character will be inserted by a key press.
But does insertion mean anything visible. Or is it more like "pass a command to the application".
The keypress event fires even if no text is inserted, for example if a web page has focus but focus is not in any input field or textarea pressing 'A' will still fire a keypress event. Regarding textInput I guess that's up to us to specify. By the name I would say it sounds like it should fire only when text is actually inserted in some editable element.
So if focus is for example on <input> and the character is visible, let's say an 'A', the text is added to the <input>. But if 'ESC' is pressed, keypress is dispatched but nothing gets updated. Or if 'ESC' is special, what about 'Backspace'?
ESC is special, I don't know why but it does fire keypress events in all legacy UAs I tested. Backspace does too, which in a way makes sense because it does cause changes to text being edited.
The textInput event also shows what character(s) were generated by an active input method editor.
textInput should be dispatched also when IME isn't active, right?
Up to us to specify but I'd say yes.
The keypress event MUST NOT fire when an IME is processing the input for conversion.
Why not? IME could emulate normal keydown/keypress/keyup.
For legacy content compatibility. IMEs that process key input do not currently cause keypress events to fire, and I believe changing this would break legacy content for IME users. (I'm fairly sure this point has been raised by implementors and I could try to find the relevant E-mails if you need them.)
-- Hallvord R. M. Steen Core QA JavaScript tester, Opera Software http://www.opera.com/ Opera - simply the best Internet experience
