Re: DOM Keyboard Event Level 3 questions about proposal

On Thu, Mar 7, 2013 at 12:24 PM, Егор Николаев <termi1uc1@gmail.com> wrote:

>
> As for "code" property. It is the same problem as "key". Why this property
> exists in the first place? What should "code" property bring to developer,
> that keyCode can't? What should make me to abandon keyCode  in favor of
> "code"?
>

Conceptually, 'code' is the same as 'keyCode'. The crucial difference
between the two is that 'code' has has a spec that defines the values that
should be returned for each key so that it will be consistently implemented
across browsers. The DOM2 spec never specified the 'keyCode' attribute so
each browser implemented the field differently.

A new 'code' field is being introduced (rather than re-defining the old
'keyCode' value) so that existing code does not break.

-Gary

Received on Thursday, 7 March 2013 20:48:31 UTC