API.md does not currently specify the exact behaviour expected when commiting a SetAttributes edit with some attributesNS in it. The documentation might give the reader the impression that we will be simply calling element.setAttribute(...) and element.setAttributeNS(...) repeatedly.
However, our current implementation at @OpenEnergyTools/xml-lib tries to be a bit smarter and automatically handle namespace prefixes if the user tries to set an attribute without one in attributesNS. This "smarter" behaviour is error-prone (there might be clashes when guessing unique prefix strings) and will likely become a bit of a foot-gun.
I therefore propose that we move away from the "smart" behaviour to the expected behaviour of just calling element.setAttributeNS for each attribute listed in attributesNS and let the creator of the Edit bear responsibility for choosing and adding appropriate namespace prefixes as needed. Then we could explicitly advertise that behaviour within API.md
API.mddoes not currently specify the exact behaviour expected when commiting a SetAttributes edit with some attributesNS in it. The documentation might give the reader the impression that we will be simply callingelement.setAttribute(...)andelement.setAttributeNS(...)repeatedly.However, our current implementation at @OpenEnergyTools/xml-lib tries to be a bit smarter and automatically handle namespace prefixes if the user tries to set an attribute without one in
attributesNS. This "smarter" behaviour is error-prone (there might be clashes when guessing unique prefix strings) and will likely become a bit of a foot-gun.I therefore propose that we move away from the "smart" behaviour to the expected behaviour of just calling
element.setAttributeNSfor each attribute listed inattributesNSand let the creator of theEditbear responsibility for choosing and adding appropriate namespace prefixes as needed. Then we could explicitly advertise that behaviour withinAPI.md