Permalink
Browse files

Change API of domEvents

The stop method became prevent and added a new stop method. Stop now
stops event propagation and prevent does the prevent default
  • Loading branch information...
1 parent 831d4e1 commit 902e50fadfc30818bfb9d21a5458fdde1edf941a @bryanjswift committed Mar 28, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 js/modules/domEvents.js
View
@@ -24,17 +24,24 @@ define(function() {
obj.detachEvent("on" + type, obj[type + fn]);
obj[type + fn] = null;
obj["e" + type + fn] = null;
+ } else if (console && console.warn) {
+ console.warn('no way to remove event from', node, name);
}
}
- function stopEvent(e) {
+ function preventEvent(e) {
if (e && e.preventDefault) { e.preventDefault(); }
if (e) { e.returnValue = false; }
}
+ function stopEvent(e) {
+ if (e.stopPropagation) { e.stopPropagation(); }
+ }
+
return {
off: removeEvent,
on: addEvent,
+ prevent: preventEvent,
stop: stopEvent
};

0 comments on commit 902e50f

Please sign in to comment.