Skip to content

Commit

Permalink
Merge pull request #4 from elo7/lenient-off
Browse files Browse the repository at this point in the history
[lenient-off] Fix error when offing a named event
  • Loading branch information
erikatakahara authored Jan 18, 2017
2 parents b90d9fc + 702fa0a commit 2bbd0b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions events-amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define('event', [], function() {

function removeEvent(el, eventName, named) {
if (el['_event']) {
if (named) {
if (named && el['_event'][eventName]) {
el['_event'][eventName][named] = [];
} else {
el['_event'][eventName] = {};
Expand All @@ -19,7 +19,10 @@ define('event', [], function() {

function eventsCommandsFor(el, eventName, named) {
if (named) {
return el['_event'][eventName][named];
if (el['_event'] && el['_event'][eventName]) {
return el['_event'][eventName][named] || [];
}
return [];
}
var commands = [];
if (el['_event']) {
Expand Down

0 comments on commit 2bbd0b8

Please sign in to comment.