xml-flow icon indicating copy to clipboard operation
xml-flow copied to clipboard

`simplifyNodes = false` affects only the top-level node

Open DrMurx opened this issue 1 year ago • 0 comments

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)

DrMurx avatar Nov 29 '23 21:11 DrMurx