From f6fdbd349d3f4cf612bcaa2c74b2e77a6cce04c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 21 Jun 2011 00:37:03 +0100 Subject: [PATCH] Define DomEvent.stop() as a shortcut to stopPropagation() / preventDefault(). --- src/browser/DomEvent.js | 7 ++++++- src/ui/Event.js | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/browser/DomEvent.js b/src/browser/DomEvent.js index dd5e1f03..2bf7d2ea 100644 --- a/src/browser/DomEvent.js +++ b/src/browser/DomEvent.js @@ -79,7 +79,12 @@ var DomEvent = { } else { event.cancelBubble = true; } - } + }, + + stop: function(event) { + DomEvent.stopPropagation(event); + DomEvent.preventDefault(event); + }, }; DomEvent.requestAnimationFrame = new function() { diff --git a/src/ui/Event.js b/src/ui/Event.js index 56db28bb..a1a45075 100644 --- a/src/ui/Event.js +++ b/src/ui/Event.js @@ -29,8 +29,7 @@ var Event = this.Event = Base.extend({ }, stop: function() { - this.stopPropagation(); - this.preventDefault(); + DomEvent.stop(this.event); }, // DOCS: Document Event#modifiers