ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [2/7] incubator-ponymail git commit: also allow numbers, balk if a key is missing
Date Mon, 05 Sep 2016 14:35:36 GMT
also allow numbers, balk if a key is missing

allow numbers to be set as attribute values
complain if we try to sub-edit an attribute that doesn't exist


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/bbb5715c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/bbb5715c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/bbb5715c

Branch: refs/heads/coffee-and-cake
Commit: bbb5715c65e3ae49e3142d8e89982419a0cd9694
Parents: cb4ad70
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Mon Sep 5 16:32:16 2016 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Mon Sep 5 16:32:16 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/dom_utils.coffee | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/bbb5715c/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index 434e8f4..d84d4f6 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -48,7 +48,7 @@ class HTML
         if isHash(params)
             for key, val of params
                 ### Standard string value? ###
-                if typeof val is "string"
+                if typeof val is "string" or typeof val is 'number'
                     @element.setAttribute(key, val)
                 else if isArray(val)
                     ### Are we passing a list of data to set? concatenate then ###
@@ -56,6 +56,8 @@ class HTML
                 else if isHash(val)
                     ### Are we trying to set multiple sub elements, like a style? ###
                     for subkey,subval of val
+                        if not @element[key]
+                            throw "No such attribute, #{key}!"
                         @element[key][subkey] = subval
         
         ### If any children have been passed, add them to the element  ###


Mime
View raw message