auto merge of #2175 : Manishearth/servo/domtests-createevent, r=Ms2ger

#2172

All subtests of `dom/events/Event-defaultPrevented.html` pass now.

CustomEvent has yet to be implemented.(#2173)
This commit is contained in:
bors-servo 2014-04-19 06:22:07 -04:00
commit 4331fad53d
2 changed files with 6 additions and 4 deletions

View file

@ -363,10 +363,11 @@ impl Document {
// http://dom.spec.whatwg.org/#dom-document-createevent // http://dom.spec.whatwg.org/#dom-document-createevent
pub fn CreateEvent(&self, interface: DOMString) -> Fallible<JS<Event>> { pub fn CreateEvent(&self, interface: DOMString) -> Fallible<JS<Event>> {
match interface.as_slice() { match interface.to_ascii_lower().as_slice() {
"UIEvents" => Ok(EventCast::from(&UIEvent::new(&self.window))), // FIXME: Implement CustomEvent (http://dom.spec.whatwg.org/#customevent)
"MouseEvents" => Ok(EventCast::from(&MouseEvent::new(&self.window))), "uievents" | "uievent" => Ok(EventCast::from(&UIEvent::new(&self.window))),
"HTMLEvents" => Ok(Event::new(&self.window)), "mouseevents" | "mouseevent" => Ok(EventCast::from(&MouseEvent::new(&self.window))),
"htmlevents" | "events" | "event" => Ok(Event::new(&self.window)),
_ => Err(NotSupported) _ => Err(NotSupported)
} }
} }

View file

@ -137,6 +137,7 @@ impl Event {
self.cancelable = cancelable; self.cancelable = cancelable;
self.bubbles = bubbles; self.bubbles = bubbles;
self.initialized = true; self.initialized = true;
self.default_prevented = false;
} }
pub fn IsTrusted(&self) -> bool { pub fn IsTrusted(&self) -> bool {