I made PR #1164, to revert a change you made back in December 2019 that prevented copying the blank value. It fixes the issue in my testing.
If there is a change to save space (i.e. _value == "" => _value = null), then I think it would be better done elsewhere and more holistically, rather than having original XML vs. XML.copy() behave differently. At least, it makes it harder to code and test for both cases. Perhaps someone could add a test for this case, if there isn't one already. On 11/12/2021 12:19 PM, Edward Stangler wrote: > > Why is XML.copy() not setting ""? > > > On 11/12/2021 4:05 AM, Harbs wrote: >> xml.toXMLString() is correct. >> >> <foo baz="”/> >> >> after: >> xml2 = data.copy(); >> >> <foo baz="null”/> >> >> I believe there’s two problems: >> >> 1. XML.toString() blindly returns _value for attributes even though >> they can be undefined. Leaving them undefined saves memory. >> 2. XML.escapeAttributeValue uses String(value) which can result in >> “undefined”. >> > >