W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: Replacing the event keyCode value.

From: João Eiras <joaoe@opera.com>
Date: Fri, 02 Dec 2011 00:53:47 -0000
To: www-dom@w3.org
Message-ID: <op.v5t7fxvq2q99of@coruscant>
On , Aryeh Gregor <ayg@aryeh.name> wrote:

> On Wed, Nov 23, 2011 at 9:00 AM, Olli Pettay <Olli.Pettay@helsinki.fi>  
> wrote:
>> Replace the value of keyCode in which way?
>> Could you give an example what used to work and what doesn't work
>> anymore. Also, note that Internet Explorer didn't support DOM events
>> before IE9, although other browsers did.
> Links to the discussions you found would be useful too.

IE allows the keyCode property in the event object to be assigned, like

# if (event.keyCode == 27) event.keyCode = 13;

and with a special quirk, assigning 0 prevents the event.

This is Microsoft's proprietary behavior, and if that is a serious  
interoperability issue, then you should use the X-UA-Compatible header or  
meta tag, or Microsft could allow keyCode to be writable from event  
listeners registered using attachEvent.

Anyway, not a specification issue. The specification has been like this  
since ever.
Received on Friday, 2 December 2011 00:54:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:59 UTC