Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Original: https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2
(function(document, window) {
"use strict";
document.addEventListener("DOMContentLoaded", function() {
var baseUrl = window.location.href
.replace(window.location.hash, "");
[].slice.call(document.querySelectorAll("use[*|href]"))
.filter(function(element) {
return (element.getAttribute("xlink:href").indexOf("#") === 0);
})
.forEach(function(element) {
element.setAttribute("xlink:href", baseUrl + element.getAttribute("xlink:href"));
});
[].slice.call(document.querySelectorAll("[clip-path]"))
.filter(function(element) {
return (element.getAttribute("clip-path").indexOf("url(#") === 0);
})
.forEach(function(element) {
element.setAttribute("clip-path", 'url('+ baseUrl + element.getAttribute("clip-path").replace(/url\((.*)\)/,'$1')+')');
});
}, false);
}(document, window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.