You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var DOMParser = require("xmldom").DOMParser;
var XMLSerializer = require("xmldom").XMLSerializer;
var xml = new DOMParser().parseFromString("<x></x>", 'text/xml');
var attr = xml.createAttribute("a");
attr.nodeValue = "b";
xml.documentElement.setAttributeNode(attr);
var str = new XMLSerializer().serializeToString(xml);
console.log(str);
The result:
> node domsample.js
C:\Users\xxx\AppData\Roaming\npm\node_modules\xmldom\dom.js:952
return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),
^
TypeError: Cannot call method 'replace' of undefined
at serializeToString (C:\Users\xxx\AppData\Roaming\npm\node_modules\xmldom\dom.js:952:49)
at serializeToString (C:\Users\xxx\AppData\Roaming\npm\node_modules\xmldom\dom.js:923:4)
at serializeToString (C:\Users\xxx\AppData\Roaming\npm\node_modules\xmldom\dom.js:947:4)
at XMLSerializer.serializeToString (C:\Users\xxx\AppData\Roaming\npm\node_modules\xmldom\dom.js:907:2)
at Object.<anonymous> (C:\home\xmldom\domsample.js:9:31)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
I think that nodeValue of Attr should be the alias of value property.
Hi, I wrote the followings:
The result:
I think that nodeValue of Attr should be the alias of value property.
dom standard of whatwg (https://dom.spec.whatwg.org/#interface-attr) defines:
The text was updated successfully, but these errors were encountered: