Created
October 9, 2015 14:13
-
-
Save xperiments/6702078c46ee1ec5d039 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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