W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2010

Re: what should event.key be if a key inserts multiple characters?

From: Ojan Vafai <ojan@chromium.org>
Date: Tue, 25 May 2010 15:33:50 -0700
Message-ID: <AANLkTilPFQd5ObVjn1rxXNq_J7R02LJXYun57JD_NKlR@mail.gmail.com>
To: "Hallvord R. M. Steen" <hallvord@opera.com>
Cc: www-dom@w3.org, Jacob Rossi <rossi@gatech.edu>, Erik Arvidsson <arv@chromium.org>, Alex Russell <slightlyoff@chromium.org>
On Tue, May 25, 2010 at 2:42 PM, Hallvord R. M. Steen <hallvord@opera.com>wrote:

> On Tue, 25 May 2010 00:47:16 +0200, Jacob Rossi <rossi@gatech.edu> wrote:
>
>  .keyCode  -  Deprecated. Use .key
>> .charCode - Deprecated. Use .char
>> .key - Name of key being pressed.
>> .char - character value produced. Empty string if the key does not
>> produce a character (arrow keys, function keys, etc.).
>>
>
> Short and sweet, with a clear link to the related properties from the past.
> Good naming, sir :)


Does .key have a value for character producing keys? If so, it is always
equal to the .char value?

It seems cleaner to me to keep the two totally separate and have .key be the
empty string for character producing keys. The fact keyCode and
charCode  often have the same value and sometimes don't is a considerable
source of confusion for web developers.

Ojan
Received on Tuesday, 25 May 2010 22:34:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:04 GMT