function fixLinks(root) {
const fragment = /url\((#[^)]+)\)/;
const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, null, false);
while (walker.nextNode()) {
for (const attr of walker.currentNode.attributes) {
const url = attr.value.match(fragment);
if (url) attr.value = attr.value.replace(url[1], location + url[1]);
}
}
return root;
}