fix(browser_adapter): event creation fails (IE11, Firefox)

This commit is contained in:
Marc Laval 2015-05-21 11:51:48 +02:00
parent f35dbb99b5
commit 665ccafd73
1 changed files with 4 additions and 2 deletions

View File

@ -70,12 +70,14 @@ dispatchEvent(el, evt) {
el.dispatchEvent(evt); el.dispatchEvent(evt);
} }
createMouseEvent(eventType: string): MouseEvent { createMouseEvent(eventType: string): MouseEvent {
var evt: MouseEvent = new MouseEvent(eventType); var evt: MouseEvent = document.createEvent('MouseEvent');
evt.initEvent(eventType, true, true); evt.initEvent(eventType, true, true);
return evt; return evt;
} }
createEvent(eventType): Event { createEvent(eventType): Event {
return new Event(eventType, true); var evt: Event = document.createEvent('Event');
evt.initEvent(eventType, true, true);
return evt;
} }
preventDefault(evt: Event) { preventDefault(evt: Event) {
evt.preventDefault(); evt.preventDefault();