Skip to content

Commit

Permalink
Allow scoped to be a selector and bind mousetrap to that selector ins…
Browse files Browse the repository at this point in the history
…tead of the current node.
  • Loading branch information
Adam Petrie committed Oct 9, 2015
1 parent d52e551 commit acbac10
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/create-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export default function(bindEvent, unbindEvent) {
if (actionObject.global === false) {
mousetrap = new Mousetrap(document);
} else if (actionObject.scoped) {
mousetrap = new Mousetrap(self.get('element'));
if (Ember.typeOf(actionObject.scoped) === 'boolean') {
mousetrap = new Mousetrap(self.get('element'));
} else if (Ember.typeOf(actionObject.scoped) === 'string') {
mousetrap = new Mousetrap(document.querySelector(actionObject.scoped));
}
} else if (actionObject.targetElement) {
mousetrap = new Mousetrap(actionObject.targetElement);
}
Expand Down

0 comments on commit acbac10

Please sign in to comment.