From 727f04aac784382e7ecb18b817830d145355b735 Mon Sep 17 00:00:00 2001 From: s-ol Date: Fri, 19 Oct 2018 15:12:19 +1100 Subject: switch to self-rendering lua code --- lib/html.client.moon | 5 ++--- lib/html.server.moon | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/html.client.moon b/lib/html.client.moon index 2538f8d..45794da 100644 --- a/lib/html.client.moon +++ b/lib/html.client.moon @@ -1,5 +1,3 @@ -document = js.global.document - element = (element) -> (...) -> children = { ... } @@ -12,7 +10,8 @@ element = (element) -> (...) -> with e = document\createElement element for k,v in pairs attributes - e[k] = v + if 'string' == type k + e[k] = v -- if there is only one argument, -- children can be in attributes table too diff --git a/lib/html.server.moon b/lib/html.server.moon index bbeaa9d..cc68fc7 100644 --- a/lib/html.server.moon +++ b/lib/html.server.moon @@ -10,6 +10,7 @@ element = (element) -> (...) -> b = "<#{element}" for k,v in pairs attributes + continue unless 'string' == type k if 'table' == type v tmp = '' for kk, vv in pairs v -- cgit v1.2.3