From fa7fc9fdc841f929084744968845cc4fcaa6e1e6 Mon Sep 17 00:00:00 2001 From: mygithub-user <36620164+mygithub-user@users.noreply.github.com> Date: Mon, 19 Feb 2018 23:47:22 +0200 Subject: [PATCH] namespaceURI should be null and not undefined According to DOM spec, Applications should use the value null as the namespaceURI parameter for methods if they wish to have no namespace. --- dom-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom-parser.js b/dom-parser.js index e45dd47..a3a0fe2 100644 --- a/dom-parser.js +++ b/dom-parser.js @@ -84,7 +84,7 @@ DOMHandler.prototype = { }, startElement:function(namespaceURI, localName, qName, attrs) { var doc = this.doc; - var el = doc.createElementNS(namespaceURI, qName||localName); + var el = doc.createElementNS(namespaceURI || null, qName||localName); var len = attrs.length; appendElement(this, el); this.currentElement = el; @@ -94,7 +94,7 @@ DOMHandler.prototype = { var namespaceURI = attrs.getURI(i); var value = attrs.getValue(i); var qName = attrs.getQName(i); - var attr = doc.createAttributeNS(namespaceURI, qName); + var attr = doc.createAttributeNS(namespaceURI || null, qName); this.locator &&position(attrs.getLocator(i),attr); attr.value = attr.nodeValue = value; el.setAttributeNode(attr)