Comparing version 1.1.22 to 1.1.23
{ | ||
"name": "svgxuse", | ||
"version": "1.1.22", | ||
"version": "1.1.23", | ||
"description": "A polyfill that fetches external SVGs referenced in use elements when the browser itself fails to do so.", | ||
@@ -5,0 +5,0 @@ "main": "svgxuse.js", |
@@ -5,3 +5,3 @@ /*! | ||
* See https://github.com/Keyamoon/svgxuse | ||
* @version 1.1.22 | ||
* @version 1.1.23 | ||
*/ | ||
@@ -54,12 +54,18 @@ /*jslint browser: true */ | ||
// Therefore, XDomainRequest should only be used with cross origin requests. | ||
function getOrigin(href) { | ||
var a = document.createElement('a'); | ||
a.href = href; | ||
return a.protocol + a.hostname; | ||
function getOrigin(loc) { | ||
var a; | ||
if (loc.protocol !== undefined) { | ||
a = loc; | ||
} else { | ||
a = document.createElement('a'); | ||
a.href = loc; | ||
} | ||
return a.protocol.replace(/:/g, '') + a.host; | ||
} | ||
var Request; | ||
var origin = location.protocol + location.hostname; | ||
var origin; | ||
var origin2; | ||
if (window.XMLHttpRequest) { | ||
Request = new XMLHttpRequest(); | ||
origin = getOrigin(location); | ||
origin2 = getOrigin(url); | ||
@@ -66,0 +72,0 @@ if (Request.withCredentials === undefined && origin2 !== '' && origin2 !== origin) { |
@@ -5,8 +5,8 @@ /*! | ||
* See https://github.com/Keyamoon/svgxuse | ||
* @version 1.1.22 | ||
* @version 1.1.23 | ||
*/ | ||
(function(){if(window&&window.addEventListener){var c=Object.create(null),m,q,d=function(){clearTimeout(q);q=setTimeout(m,100)},n=function(){},t=function(){var e;window.addEventListener("resize",d,!1);window.addEventListener("orientationchange",d,!1);window.MutationObserver?(e=new MutationObserver(d),e.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),n=function(){try{e.disconnect(),window.removeEventListener("resize",d,!1),window.removeEventListener("orientationchange",d, | ||
!1)}catch(c){}}):(document.documentElement.addEventListener("DOMSubtreeModified",d,!1),n=function(){document.documentElement.removeEventListener("DOMSubtreeModified",d,!1);window.removeEventListener("resize",d,!1);window.removeEventListener("orientationchange",d,!1)})},u=function(e){var c,d=location.protocol+location.hostname;if(window.XMLHttpRequest){c=new XMLHttpRequest;var l=document.createElement("a");l.href=e;e=l.protocol+l.hostname;c=void 0===c.withCredentials&&""!==e&&e!==d?XDomainRequest|| | ||
void 0:XMLHttpRequest}return c};m=function(){function e(){--p;0===p&&(n(),t())}function d(a){return function(){!0!==c[a.base]&&a.useEl.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","#"+a.hash)}}function m(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);e()}}function l(a){return function(){a.onerror=null;a.ontimeout=null;e()}}var a,f,g,h,p=0,b,k;n();k=document.getElementsByTagName("use");for(h=0;h<k.length;h+=1){try{f=k[h].getBoundingClientRect()}catch(v){f=!1}g=(a=k[h].getAttributeNS("http://www.w3.org/1999/xlink","href"))&&a.split?a.split("#"):["",""];a=g[0];g=g[1];b=f&&0===f.left&&0===f.right&&0===f.top&&0===f.bottom;f&&0===f.width&&0===f.height&&!b?a.length&&(b=c[a],!0!==b&&setTimeout(d({useEl:k[h],base:a,hash:g}),0),void 0===b&& | ||
(g=u(a),void 0!==g&&(b=new g,c[a]=b,b.onload=m(b),b.onerror=l(b),b.ontimeout=l(b),b.open("GET",a),b.send(),p+=1))):b?a.length&&c[a]&&d({useEl:k[h],base:a,hash:g})():void 0===c[a]?c[a]=!0:c[a].onload&&(c[a].abort(),delete c[a].onload,c[a]=!0)}k="";p+=1;e()};window.addEventListener("load",function r(){window.removeEventListener("load",r,!1);q=setTimeout(m,0)},!1)}})(); | ||
(function(){if(window&&window.addEventListener){var e=Object.create(null),l,r,d=function(){clearTimeout(r);r=setTimeout(l,100)},p=function(){},t=function(){var g;window.addEventListener("resize",d,!1);window.addEventListener("orientationchange",d,!1);window.MutationObserver?(g=new MutationObserver(d),g.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),p=function(){try{g.disconnect(),window.removeEventListener("resize",d,!1),window.removeEventListener("orientationchange",d, | ||
!1)}catch(m){}}):(document.documentElement.addEventListener("DOMSubtreeModified",d,!1),p=function(){document.documentElement.removeEventListener("DOMSubtreeModified",d,!1);window.removeEventListener("resize",d,!1);window.removeEventListener("orientationchange",d,!1)})},u=function(g){function e(a){var c;void 0!==a.protocol?c=a:(c=document.createElement("a"),c.href=a);return c.protocol.replace(/:/g,"")+c.host}var d,n;window.XMLHttpRequest&&(d=new XMLHttpRequest,n=e(location),g=e(g),d=void 0===d.withCredentials&& | ||
""!==g&&g!==n?XDomainRequest||void 0:XMLHttpRequest);return d};l=function(){function d(){--q;0===q&&(p(),t())}function m(a){return function(){!0!==e[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 n(a){return function(){a.onerror=null;a.ontimeout=null;d()}}var a,c,f,h,q=0,b,k;p();k=document.getElementsByTagName("use");for(h=0;h<k.length;h+=1){try{c=k[h].getBoundingClientRect()}catch(v){c=!1}f=(a=k[h].getAttributeNS("http://www.w3.org/1999/xlink","href"))&&a.split?a.split("#"):["",""];a=f[0];f=f[1];b=c&&0===c.left&&0===c.right&&0===c.top&&0===c.bottom;c&&0===c.width&&0===c.height&&!b?a.length&&(b=e[a],!0!==b&&setTimeout(m({useEl:k[h],base:a, | ||
hash:f}),0),void 0===b&&(f=u(a),void 0!==f&&(b=new f,e[a]=b,b.onload=l(b),b.onerror=n(b),b.ontimeout=n(b),b.open("GET",a),b.send(),q+=1))):b?a.length&&e[a]&&m({useEl:k[h],base:a,hash:f})():void 0===e[a]?e[a]=!0:e[a].onload&&(e[a].abort(),delete e[a].onload,e[a]=!0)}k="";q+=1;d()};window.addEventListener("load",function m(){window.removeEventListener("load",m,!1);r=setTimeout(l,0)},!1)}})(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15706
231