Skip to content

Commit

Permalink
Fix #18254
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed Sep 6, 2014
1 parent d0386bc commit e4296a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion on.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./sniff"], fu
// call select to see if we match
var eventTarget = select(event.target);
// if it matches we call the listener
return eventTarget && listener.call(eventTarget, event);
if (eventTarget) {
return listener.call(eventTarget, event);
}
});
};
};
Expand Down
9 changes: 9 additions & 0 deletions tests/on/on.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,15 @@ define([
});
button.click();
t.is(testValue, 3);
},
function delegatePreventDefault(t){
var div = document.createElement("div");
div.innerHTML = '<input type="checkbox">';
var cb = div.childNodes[0];
document.body.appendChild(div);
on(div, '.matchesNothing:click', function () {});
cb.click();
t.t(cb.checked);
}
]);

Expand Down

0 comments on commit e4296a6

Please sign in to comment.