Define DomEvent.stop() as a shortcut to stopPropagation() / preventDefault().

This commit is contained in:
Jürg Lehni 2011-06-21 00:37:03 +01:00
parent 909bb6310f
commit f6fdbd349d
2 changed files with 7 additions and 3 deletions

View file

@ -79,7 +79,12 @@ var DomEvent = {
} else { } else {
event.cancelBubble = true; event.cancelBubble = true;
} }
} },
stop: function(event) {
DomEvent.stopPropagation(event);
DomEvent.preventDefault(event);
},
}; };
DomEvent.requestAnimationFrame = new function() { DomEvent.requestAnimationFrame = new function() {

View file

@ -29,8 +29,7 @@ var Event = this.Event = Base.extend({
}, },
stop: function() { stop: function() {
this.stopPropagation(); DomEvent.stop(this.event);
this.preventDefault();
}, },
// DOCS: Document Event#modifiers // DOCS: Document Event#modifiers