xmlbuilder2
xmlbuilder2 copied to clipboard
callback API reference/position error
Describe the bug new nodes aren't added to the element you refer to but to wherever the pointer currently is in the node tree, i.e. the latest element or it's parent(s) depending on the number of up() calls
To Reproduce See https://codesandbox.io/s/serverless-morning-gj0qou
function testXml(xml) {
let root=xml.ele("root")
root.ele("a")
root.ele("b")
}
export default function App() {
let xml = create();
testXml(xml);
let regular = xml.end();
let buffer = "";
let xmlCB = createCB({ data: (chunk) => (buffer = buffer + chunk) });
testXml(xmlCB);
xmlCB.end();
console.log("Regular xmlbuilder2: "+regular)
console.log("Callback xmlbuilder2: "+buffer)
...
Regular xmlbuilder2: <root><a/><b/></root>
Callback xmlbuilder2: <root><a><b/></a></root>
Expected behavior regular and callback xml should be the same
Version:
- xmlbuilder2 [3.0.2]
Additional context Add any other context about the problem here.