Skip to content

Commit

Permalink
script tag should be self closed
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAlphaFox committed Feb 15, 2019
1 parent e219bc6 commit 7382c7c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ai_dom_render.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ render(track,Node)->
render(wbr,Node)->
Attributes = attributes(ai_dom_node:attributes(Node)),
<<"<wbr",Attributes/binary,"/>">>;
render(script,Node)->
Attributes = attributes(ai_dom_node:attributes(Node)),
<<"<script",Attributes/binary,"/>">>;
render(Tag,Node) ->
TagBin = ai_string:to_string(Tag),
Value = ai_string:to_string(ai_dom_node:value(Node)),
Expand All @@ -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),
<<Acc/binary,Attr/binary,"=\"",AttrValue/binary,"\" ">>
Attr = ai_string:to_string(K),
case V of
ture -> <<Acc/binary,Attr/binary," ">>;
_->
AttrValue = ai_string:to_string(V),
<<Acc/binary,Attr/binary,"=\"",AttrValue/binary,"\" ">>
end
end,<<" ">>,maps:to_list(Attributes)).


0 comments on commit 7382c7c

Please sign in to comment.