@@ -171,7 +171,8 @@ Node(data::Raw) = Node(LazyNode(data))
171171# Anything that's not Vector{UInt8} or a (Lazy)Node is converted to a Text Node
172172Node (x) = Node (Text, nothing , nothing , string (x), nothing )
173173
174- h (tag:: Union{Symbol, String} , children... ; kw... ) = Node (Element, tag, kw, nothing , children)
174+ h (tag:: Union{Symbol, String} , children... ; kw... ) = Node (Element, tag, length (kw)== 0 ? nothing : kw, nothing , children)
175+ # h(tag::Union{Symbol, String}, children...; kw...) = Node(Element, tag, kw, nothing, children)
175176Base. getproperty (:: typeof (h), tag:: Symbol ) = h (tag)
176177(o:: Node )(children... ; kw... ) = Node (o, Node .(children)... ; kw... )
177178
@@ -240,7 +241,8 @@ function (T::NodeType)(args...; attr...)
240241 Node (T, nothing , nothing , only (args))
241242 elseif T === Element
242243 tag = first (args)
243- Node (T, tag, attr, nothing , args[2 : end ])
244+ Node (T, tag, length (attr)== 0 ? nothing : attr, nothing , args[2 : end ])
245+ # Node(T, tag, attr, nothing, args[2:end])
244246 else
245247 error (" Unreachable reached while trying to create a Node via (::NodeType)(args...; kw...)." )
246248 end
0 commit comments