Skip to content

Commit

Permalink
fix: EventTarget is also evented (#3990)
Browse files Browse the repository at this point in the history
If you try to delegate an to an EventTarget from an evented component, you'll end up failing because it didn't think that an EventTarget object worked. But it should and does. This adds a check for it in the isEvented function.
  • Loading branch information
gkatsev authored Jan 30, 2017
1 parent 866a3f3 commit e34335b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/js/mixins/evented.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as Dom from '../utils/dom';
import * as Events from '../utils/events';
import * as Fn from '../utils/fn';
import * as Obj from '../utils/obj';
import EventTarget from '../event-target';

/**
* Returns whether or not an object has had the evented mixin applied.
Expand All @@ -17,6 +18,7 @@ import * as Obj from '../utils/obj';
* Whether or not the object appears to be evented.
*/
const isEvented = (object) =>
object instanceof EventTarget ||
!!object.eventBusEl_ &&
['on', 'one', 'off', 'trigger'].every(k => typeof object[k] === 'function');

Expand Down

0 comments on commit e34335b

Please sign in to comment.