textInput event as default action of both keydown and keypress?

Hi,
spec currently says about keydown event:

> if the key is associated with a character, the default action
> shall be to dispatch a textInput event with the character as
> the value of the TextEvent.data attribute

and about the keypress event (in the table):

> Default action	Varies: textInput event;

So an implementation that follows this spec to the T might end up firing  
textInput twice for all input, once as the default action of keydown and  
once as the default action of keypress..

What implementations actually do (and current web content requires) is to  
fire *keypress* as the default action of the keydown event. Then the  
keypress event's default action is to fire textInput.

I suggest fixing the spec to say keydown's default action is a keypress  
event.

(Firefox has a small quirk that the spec IMO can ignore in that  
preventDefault() on keydown doesn't actually prevend the keypress event  
 from firing - but it fires "pre-cancelled". At some point in time, some  
legacy content required this behaviour - but other browsers align on  
making keypress entirely preventable.)

-- 
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/

Received on Wednesday, 22 September 2010 04:38:22 UTC