-
Notifications
You must be signed in to change notification settings - Fork 11
/
svgxuse.min.js
11 lines (11 loc) · 2.27 KB
/
svgxuse.min.js
1
2
3
4
5
6
7
8
9
10
11
/*!
* @copyright Copyright (c) 2016 IcoMoon.io
* @license Licensed under MIT license
* See https://github.com/Keyamoon/svgxuse
* @version 1.1.16
*/
(function(){if(window&&window.addEventListener){var c=Object.create(null),l,g,d=function(){clearTimeout(g);g=setTimeout(l,100)},q=function(){},r=function(){var c;window.addEventListener("resize",d,!1);window.addEventListener("orientationchange",d,!1);window.MutationObserver?(c=new MutationObserver(d),c.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),q=function(){try{c.disconnect(),window.removeEventListener("resize",d,!1),window.removeEventListener("orientationchange",d,
!1)}catch(p){}}):(document.documentElement.addEventListener("DOMSubtreeModified",d,!1),q=function(){document.documentElement.removeEventListener("DOMSubtreeModified",d,!1);window.removeEventListener("resize",d,!1);window.removeEventListener("orientationchange",d,!1)})};l=function(){function d(){--h;0===h&&r()}function p(a){return function(){!0!==c[a.base]&&a.useEl.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","#"+a.hash)}}function l(a){return function(){var c=document.body,b=document.createElement("x");
a.onload=null;b.innerHTML=a.responseText;if(b=b.getElementsByTagName("svg")[0])b.setAttribute("aria-hidden","true"),b.style.position="absolute",b.style.width=0,b.style.height=0,b.style.overflow="hidden",c.insertBefore(b,c.firstChild);d()}}function g(a){return function(){a.onerror=null;a.ontimeout=null;d()}}var b,e,m,f,n,h=0,a,k;window.XMLHttpRequest&&(n=new XMLHttpRequest,n=void 0!==n.withCredentials?XMLHttpRequest:XDomainRequest||void 0);if(void 0!==n){q();k=document.getElementsByTagName("use");
for(f=0;f<k.length;f+=1){try{e=k[f].getBoundingClientRect()}catch(t){e=!1}m=k[f].getAttributeNS("http://www.w3.org/1999/xlink","href").split("#");b=m[0];m=m[1];a=e&&0===e.left&&0===e.right&&0===e.top&&0===e.bottom;e&&0===e.width&&0===e.height&&!a?b.length&&(a=c[b],!0!==a&&setTimeout(p({useEl:k[f],base:b,hash:m}),0),void 0===a&&(a=new n,c[b]=a,a.onload=l(a),a.onerror=g(a),a.ontimeout=g(a),a.open("GET",b),a.send(),h+=1)):a||(void 0===c[b]?c[b]=!0:c[b].onload&&(c[b].abort(),c[b].onload=void 0,c[b]=!0))}k=
"";h+=1;d()}};window.addEventListener("load",function p(){window.removeEventListener("load",p,!1);g=setTimeout(l,0)},!1)}})();