Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Fix Firefox 24 issue related to FocusEvent
Browse files Browse the repository at this point in the history
FF24 does not support `document.createEvent('FocusEvent')` and to create a new
FocusEvent we need to use `new FocusEvent('x')`.

IE on the other hand does not support event constructors so we have to branch
here.
  • Loading branch information
arv committed Jun 18, 2013
1 parent e6e4c3a commit f183806
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/wrappers/events.js
Expand Up @@ -447,10 +447,17 @@
GenericEvent.prototype = Object.create(SuperEvent.prototype);
if (prototype)
mixin(GenericEvent.prototype, prototype);
// Firefox does not support FocusEvent
// https://bugzilla.mozilla.org/show_bug.cgi?id=855741
if (OriginalEvent)
registerWrapper(OriginalEvent, GenericEvent, document.createEvent(name));
if (OriginalEvent) {
// IE does not support event constructors but FocusEvent can only be
// created using new FocusEvent in Firefox.
// https://bugzilla.mozilla.org/show_bug.cgi?id=882165
if (OriginalEvent.prototype['init' + name]) {
registerWrapper(OriginalEvent, GenericEvent,
document.createEvent(name));
} else {
registerWrapper(OriginalEvent, GenericEvent, new OriginalEvent('temp'));
}
}
return GenericEvent;
}

Expand Down

0 comments on commit f183806

Please sign in to comment.