Bug 13368

Summary: KeyboardEvent::initKeyboardEvent doesn't match the DOM Level 3 Events spec
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: DOMAssignee: 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)
Reported 2007-04-16 22:59:14 PDT
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
Adam Roben (:aroben)
Comment 1 2007-04-16 23:09:54 PDT
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
Comment 2 2007-04-17 12:08:54 PDT
We should consider implementing this in a custom way so that both versions work.
Darin Adler
Comment 3 2008-01-04 16:39:41 PST
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
Comment 4 2008-01-04 16:40:03 PST
Sorry, I meant bug 16735.
Note You need to log in before you can comment on or make changes to this bug.