Regression: xmldom 0.1.24-0.1.27 adds xmlns attribute
cb1kenobi opened this issue · 0 comments
cb1kenobi commented
There was a regression in 0.1.24 where for some reason the namespace attribute is being added to DOM nodes when it shouldn't.
Test Case:
var DOMParser = require('xmldom').DOMParser;
var xml = `<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
</manifest>
</android>`;
var doc = new DOMParser().parseFromString(xml, 'text/xml');
console.log(doc.toString());
console.log();
var child = doc.documentElement.firstChild;
while (child) {
if (child.nodeType === 1) {
console.log(child.toString());
}
child = child.nextSibling;
}
Expected Results:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
</manifest>
</android>
<manifest>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
</manifest>
Actual Results:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
</manifest>
</android>
<manifest>
<uses-feature xmlns:android='http://schemas.android.com/apk/res/android' android:glEsVersion="0x00020000" android:required="true"/>
</manifest>
Notice that xmlns:android
was added to the <use-feature>
tag. No good.