Merge pull request #15111 from nextcloud/backport/15110/stable16

[stable16] Make sure we have a proper node before parsing
This commit is contained in:
Morris Jobke 2019-04-15 23:10:06 +02:00 committed by GitHub
commit 9b6d4c4a4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}