tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject [2/2] git commit: Enforce that the optional memo is an object (not a string)
Date Sat, 20 Oct 2012 01:16:53 GMT
Enforce that the optional memo is an object (not a string)


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1ba8c132
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1ba8c132
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1ba8c132

Branch: refs/heads/5.4-js-rewrite
Commit: 1ba8c13227532a3e54307969a9cb4ad29c818dad
Parents: d93feaa
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Fri Oct 19 17:49:33 2012 -0700
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Fri Oct 19 17:49:33 2012 -0700

----------------------------------------------------------------------
 .../coffeescript/META-INF/modules/core/spi.coffee  |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1ba8c132/tapestry-core/src/main/coffeescript/META-INF/modules/core/spi.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/core/spi.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/core/spi.coffee
index b3850ac..8af53a2 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/core/spi.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/core/spi.coffee
@@ -349,10 +349,14 @@ define ["_", "prototype"], (_) ->
     #
     # * eventName - name of event to trigger on the wrapped Element
     # * memo - optional value assocated with the event; available as WrappedeEvent.memo in
event handler functions (must
-    # be null for native events)
+    #   be null for native events). The memo, when provided, should be an object; it is an
error if it is a string or other
+    #  non-object type..
     trigger: (eventName, memo) ->
       throw new Error "Attempt to trigger event with null event name" unless eventName?
 
+      unless (_.isNull memo) or (_.isObject memo) or (_.isUndefined memo)
+        throw new Error "Event memo may be null or an object, but not a simple type."
+
       if (eventName.indexOf ':') > 0
         # Custom event is supported directly by Prototype:
         @element.fire eventName, memo


Mime
View raw message