From 7382c7ce02e58df632e9f6a9cc8312f6387285bc Mon Sep 17 00:00:00 2001 From: "David.Gao" Date: Fri, 15 Feb 2019 18:09:30 +0800 Subject: [PATCH] script tag should be self closed --- src/ai_dom_render.erl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ai_dom_render.erl b/src/ai_dom_render.erl index 1efc830..df6c696 100644 --- a/src/ai_dom_render.erl +++ b/src/ai_dom_render.erl @@ -46,6 +46,9 @@ render(track,Node)-> render(wbr,Node)-> Attributes = attributes(ai_dom_node:attributes(Node)), <<"">>; +render(script,Node)-> + Attributes = attributes(ai_dom_node:attributes(Node)), + <<"">>; render(Tag,Node) -> TagBin = ai_string:to_string(Tag), Value = ai_string:to_string(ai_dom_node:value(Node)), @@ -66,9 +69,13 @@ render([El|Rest],Stack,Acc) -> end. attributes(Attributes)-> lists:foldl(fun({K,V},Acc)-> - Attr = ai_string:to_string(K), - AttrValue = ai_string:to_string(V), - <> + Attr = ai_string:to_string(K), + case V of + ture -> <>; + _-> + AttrValue = ai_string:to_string(V), + <> + end end,<<" ">>,maps:to_list(Attributes)).