Make sure we have a proper node before parsing
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
8b2a3994a6
commit
b3c390ea1e
|
@ -82,6 +82,11 @@
|
|||
var parts = name.split(':');
|
||||
var tagName = parts[1];
|
||||
var namespace = resolver(parts[0]);
|
||||
// make sure we can get elements
|
||||
if (typeof node === 'string') {
|
||||
var parser = new DOMParser()
|
||||
node = parser.parseFromString(node, 'text/xml')
|
||||
}
|
||||
if (node.getElementsByTagNameNS) {
|
||||
return node.getElementsByTagNameNS(namespace, tagName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue