Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 902e50fadfc30818bfb9d21a5458fdde1edf941a 1 parent 831d4e1
@bryanjswift authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 js/modules/domEvents.js
View
9 js/modules/domEvents.js
@@ -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
};
Please sign in to comment.
Something went wrong with that request. Please try again.