You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2014/04/02 00:10:15 UTC
[5/6] git commit: Simulate jQuery's stopImmediatePropagation() for in
the Prototype EventWrapper
Simulate jQuery's stopImmediatePropagation() for in the Prototype EventWrapper
Fixes issues where Ajax form submissions could occur even after validation errors
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1008eb60
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1008eb60
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1008eb60
Branch: refs/heads/master
Commit: 1008eb60fc66f516f001e47e2ce16c89db76df72
Parents: c35d588
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Apr 1 14:54:56 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Apr 1 15:10:07 2014 -0700
----------------------------------------------------------------------
.../org/apache/tapestry5/t5-core-dom.coffee | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1008eb60/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index c76a6fe..64bb6cf 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -120,6 +120,7 @@ define ["underscore", "./utils", "./events", "jquery"],
@nativeEvent.preventDefault()
@nativeEvent.stopImmediatePropagation()
#elseif prototype
+ # There's no equivalent to stopImmediatePropagation() unfortunately.
@nativeEvent.stop()
#endif
@@ -178,7 +179,11 @@ define ["underscore", "./utils", "./events", "jquery"],
elementWrapper = new ElementWrapper prototypeEvent.findElement()
eventWrapper = new EventWrapper prototypeEvent
- result = handler.call elementWrapper, eventWrapper, eventWrapper.memo
+ # Because there's no stopImmediatePropogation() as with jQuery, we detect if the
+ # event was stopped and simply stop calling the handler.
+ result = if prototypeEvent.stopped
+ false
+ else handler.call elementWrapper, eventWrapper, eventWrapper.memo
# If an event handler returns exactly false, then stop the event.
if result is false