From 30fb0dc40d595b9e0b7747ad8e5c4e8cf7e3023b Mon Sep 17 00:00:00 2001 From: s-ol Date: Thu, 1 Nov 2018 21:17:55 +1100 Subject: move mmm code from lib to mmm etc --- lib/dom.client.moon | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 lib/dom.client.moon (limited to 'lib/dom.client.moon') diff --git a/lib/dom.client.moon b/lib/dom.client.moon deleted file mode 100644 index acdbfa4..0000000 --- a/lib/dom.client.moon +++ /dev/null @@ -1,33 +0,0 @@ -element = (element) -> (...) -> - children = { ... } - - -- attributes are last arguments but mustn't be a ReactiveVar - attributes = children[#children] - if 'table' == (type attributes) and not attributes.node - table.remove children - else - attributes = {} - - with e = document\createElement element - for k,v in pairs attributes - k = 'className' if k == 'class' - if k == 'style' and 'table' == type v - for kk,vv in pairs v - e.style[kk] = vv - elseif 'string' == type k - e[k] = v - - -- if there is only one argument, - -- children can be in attributes table too - if #children == 0 - children = attributes - - for child in *children - if 'string' == type child - child = document\createTextNode child - - e\appendChild child - -setmetatable {}, __index: (name) => - with val = element name - @[name] = val -- cgit v1.2.3