From 8844d29223626240ff99a0cdaccf1ee5a36cb3f6 Mon Sep 17 00:00:00 2001 From: s-ol Date: Fri, 19 Oct 2018 01:16:10 +1100 Subject: towards self-compiling --- app/html.client.moon | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 app/html.client.moon (limited to 'app/html.client.moon') diff --git a/app/html.client.moon b/app/html.client.moon deleted file mode 100644 index 77d6c51..0000000 --- a/app/html.client.moon +++ /dev/null @@ -1,36 +0,0 @@ -document = js.global.document - -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 - 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 - e.innerHTML ..= child - else - e\appendChild child - -elements = {} -add = (e) -> elements[e] = element e - -for e in *{'div', 'form', 'span', 'a', 'p', 'button', 'ul', 'ol', 'li', 'i', 'b', 'u', 'tt'} do add e -for e in *{'article', 'section', 'header', 'footer', 'content'} do add e -for e in *{'br', 'hr', 'img', 'input', 'p', 'textarea'} do add e -for i=1,8 do add "h" .. i - -elements -- cgit v1.2.3