diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 2b8632fd7c16..7e282c4992da 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -46,6 +46,7 @@ use dom::htmlhtmlelement::HTMLHtmlElement; use dom::htmltitleelement::HTMLTitleElement; use dom::location::Location; use dom::mouseevent::MouseEvent; +use dom::keyboardevent::KeyboardEvent; use dom::node::{Node, ElementNodeTypeId, DocumentNodeTypeId, NodeHelpers}; use dom::node::{CloneChildren, DoNotCloneChildren}; use dom::nodelist::NodeList; @@ -693,6 +694,8 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { CustomEvent::new_uninitialized(&global::Window(*window)))), "htmlevents" | "events" | "event" => Ok(Event::new_uninitialized( &global::Window(*window))), + "keyboardevent" | "keyevents" => Ok(EventCast::from_temporary( + KeyboardEvent::new_uninitialized(*window))), _ => Err(NotSupported) } } diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index b48a32952990..787cedc857f1 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -59,7 +59,7 @@ impl KeyboardEvent { } } - fn new_uninitialized(window: JSRef) -> Temporary { + pub fn new_uninitialized(window: JSRef) -> Temporary { reflect_dom_object(box KeyboardEvent::new_inherited(), &global::Window(window), KeyboardEventBinding::Wrap) diff --git a/tests/wpt/metadata/dom/events/EventTarget-dispatchEvent.html.ini b/tests/wpt/metadata/dom/events/EventTarget-dispatchEvent.html.ini index 823e47a3e90b..cd9c31f59acf 100644 --- a/tests/wpt/metadata/dom/events/EventTarget-dispatchEvent.html.ini +++ b/tests/wpt/metadata/dom/events/EventTarget-dispatchEvent.html.ini @@ -1,11 +1,5 @@ [EventTarget-dispatchEvent.html] type: testharness - [If the event\'s initialized flag is not set, an InvalidStateError must be thrown (KeyboardEvent).] - expected: FAIL - - [If the event\'s initialized flag is not set, an InvalidStateError must be thrown (KeyEvents).] - expected: FAIL - [If the event\'s initialized flag is not set, an InvalidStateError must be thrown (MessageEvent).] expected: FAIL diff --git a/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini b/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini index ae1c9323e64e..90869a4c6d99 100644 --- a/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini +++ b/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini @@ -1,41 +1,5 @@ [Document-createEvent.html] type: testharness - [KeyboardEvent should be an alias for KeyboardEvent.] - expected: FAIL - - [createEvent(\'KeyboardEvent\') should be initialized correctly.] - expected: FAIL - - [keyboardevent should be an alias for KeyboardEvent.] - expected: FAIL - - [createEvent(\'keyboardevent\') should be initialized correctly.] - expected: FAIL - - [KEYBOARDEVENT should be an alias for KeyboardEvent.] - expected: FAIL - - [createEvent(\'KEYBOARDEVENT\') should be initialized correctly.] - expected: FAIL - - [KeyEvents should be an alias for KeyboardEvent.] - expected: FAIL - - [createEvent(\'KeyEvents\') should be initialized correctly.] - expected: FAIL - - [keyevents should be an alias for KeyboardEvent.] - expected: FAIL - - [createEvent(\'keyevents\') should be initialized correctly.] - expected: FAIL - - [KEYEVENTS should be an alias for KeyboardEvent.] - expected: FAIL - - [createEvent(\'KEYEVENTS\') should be initialized correctly.] - expected: FAIL - [MessageEvent should be an alias for MessageEvent.] expected: FAIL