xml-flow
xml-flow copied to clipboard
`simplifyNodes = false` affects only the top-level node
With useArray = SOMETIMES
and preserveMarkup = SOMETIMES
, a setting of simplifyNodes = false
doesn't behave as expected. It affects on the emitted top-level node, while all sub-nodes are still simplified.
For example:
<top class="x">
<sub type="a" />
<sub type="b" />
</top>
will result in
top: {
$attrs: { class: "x" },
sub: [
{ type: "a" },
{ type: "b"}
]
}
but I'd expect
top: {
$attrs: { class: "x" },
sub: [
{
$attrs: { type: "a" }
},
{
$attrs: { type: "b" }
}
]
}
(It's also debatable whether the entries in the sub
array should be stripped of their $name
key - even if it's redundant, it wouldn't hurt)