diff --git a/js/artInfrastructure.js b/js/artInfrastructure.js index 6b3bf218b0ee97abe148bdbcc0b9dd4abeaa33f4..b416cc6d4698fb7a6ffb9847ddca2cf51d3697b2 100644 --- a/js/artInfrastructure.js +++ b/js/artInfrastructure.js @@ -1,4 +1,18 @@ App.Art.cacheArtData = function() { + /** @param {Element} node */ + function removeBadNamespaces(node) { + const attrs = node.attributes; + for (let index = 0; index < attrs.length; ++index) { + const attr = attrs[index]; + if (attr.name.startsWith("sodipodi") || attr.name.startsWith("inkscape")) { + node.attributes.removeNamedItem(attr.name); + } + for (const child of node.children) { + removeBadNamespaces(child); + } + } + } + /** * @param {NodeListOf<Element>} imagePassages * @returns {Map<string, Element>} @@ -11,6 +25,7 @@ App.Art.cacheArtData = function() { let div = document.createElement("div"); const svgData = atob(ip.innerHTML.replace(/data:image\/svg\+xml;base64,/, '')); div.innerHTML = svgData.trim(); + removeBadNamespaces(div.children.item(0)); dict.set(name, div.children.item(0)); }