Bug 156446
Summary: | keyCode and charCode properties should live in KeyboardEvent, not UIEvent | ||
---|---|---|---|
Product: | WebKit | Reporter: | Chris Rebert <webkit> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | rbuis, sam, simon.fraser |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Mac | ||
OS: | OS X 10.11 |
Chris Rebert
The following evaluates to true in WebKit Nightly, and to false in Chrome, Firefox, and Edge:
'keyCode' in UIEvent.prototype && 'charCode' in UIEvent.prototype
Per the UI Events spec, keyCode and charCode should be properties of KeyboardEvent, not of UIEvent. See:
* https://w3c.github.io/uievents/#interface-uievent
* https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Simon Fraser (smfr)
keyCode and charCode were present on UIEvent from long ago in the codebase. KeyboardEvent has them in the IDL, but hidden from JavaScript, oddly.
Neither match the spec[1], which has:
readonly attribute DOMString key;
readonly attribute DOMString code;
[1] https://w3c.github.io/uievents/#events-keyboardevents
Chris Rebert
To clarify, I'm referring to the legacy[1] KeyboardEvent.keyCode and KeyboardEvent.charCode properties:
partial interface KeyboardEvent {
// The following support legacy user agents
readonly attribute unsigned long charCode;
readonly attribute unsigned long keyCode;
which are distinct from the modern[2] KeyboardEvent.key and KeyboardEvent.code properties.
[1]: https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent
[2]: https://w3c.github.io/uievents/#events-keyboardevents
Lucas Forschler
Mass move bugs into the DOM component.
Rob Buis
This was fixed by r209895.