Bug 13368
Summary: | KeyboardEvent::initKeyboardEvent doesn't match the DOM Level 3 Events spec | ||
---|---|---|---|
Product: | WebKit | Reporter: | Adam Roben (:aroben) <aroben> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ap, aroben, k.y.sergey, syoichi |
Priority: | P2 | ||
Version: | 523.x (Safari 3) | ||
Hardware: | Mac | ||
OS: | All |
Adam Roben (:aroben)
Our implementation of KeyboardEvent::initKeyboardEvent doesn't match the DOM Level 3 Events spec.
See the spec here:
http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-KeyboardEvents-Interfaces
See current implementation of the method here:
http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/dom/KeyboardEvent.cpp?rev=19579#L66
Our implementation takes 5 booleans representing the state of the 5 modifier keys, while the spec defines the last argument of the method to be DOMString containing a space-separated list of modifier keys.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Adam Roben (:aroben)
It looks like WebKit is implementing an old version of this method. http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-KeyboardEvents-Interfaces contains a definition that matches WebKit's, and it looks like WebKit's method was checked in on 2003-10-20 (http://trac.webkit.org/projects/webkit/changeset/5226)
Darin Adler
We should consider implementing this in a custom way so that both versions work.
Darin Adler
Also, bug 16375 points out that events crated with initKeyboardEvent aren't very good because they will always have a keyCode of 0 and charCode of 0. So any code that looks at keyCode or charCode, including code inside the engine that responds to keyboard events and older legacy JavaScript code, won't work with these events.
Darin Adler
Sorry, I meant bug 16735.