Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-inlinesvg

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-inlinesvg - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

41

lib/index.js

@@ -1,2 +0,2 @@

var InlineSVGError, PropTypes, React, Status, XHR, configurationError, createError, delay, httpError, isSupportedEnvironment, me, once, span, supportsInlineSVG, unsupportedBrowserError,
var InlineSVGError, PropTypes, React, Status, configurationError, createError, createXHR, delay, httpError, isSupportedEnvironment, me, once, span, supportsInlineSVG, unsupportedBrowserError, urllite,
__slice = [].slice,

@@ -10,2 +10,4 @@ __hasProp = {}.hasOwnProperty,

urllite = require('urllite/lib/core');
PropTypes = React.PropTypes;

@@ -100,6 +102,6 @@

var done, xhr;
xhr = new XHR();
xhr = createXHR(this.props.src);
done = once(delay((function(_this) {
return function(err) {
xhr.onload = xhr.onerror = xhr.onreadystatechange = null;
xhr.onload = xhr.onerror = xhr.onreadystatechange = xhr.ontimeout = xhr.onprogress = null;
if (err) {

@@ -134,3 +136,7 @@ return _this.fail(err);

};
xhr.open('GET', this.props.src);
xhr.ontimeout = function() {};
xhr.onprogress = function() {};
xhr.open('GET', this.props.src.replace(/[^%]+/g, function(s) {
return encodeURI(s);
}));
return xhr.send();

@@ -177,11 +183,26 @@ },

XHR = (function() {
createXHR = function(src) {
var XDR, XHR, a, b, xhr;
if (typeof window === "undefined" || window === null) {
return null;
}
if ((XHR = window.XMLHttpRequest) && 'withCredentials' in new XHR) {
return XHR;
if (XHR = window.XMLHttpRequest) {
xhr = new XHR;
if ('withCredentials' in xhr) {
return xhr;
}
}
return window.XDomainRequest;
})();
if (XDR = window.XDomainRequest) {
a = urllite(src);
b = urllite(window.location.href);
if (!a.host) {
return xhr;
}
if (a.protocol === b.protocol && a.host === b.host && a.port === b.port) {
return xhr;
}
return new XDR;
}
return xhr;
};

@@ -200,3 +221,3 @@ delay = function(fn) {

isSupportedEnvironment = once(function() {
return XHR && supportsInlineSVG();
return ((typeof window !== "undefined" && window !== null ? window.XMLHttpRequest : void 0) || (typeof window !== "undefined" && window !== null ? window.XDomainRequest : void 0)) && supportsInlineSVG();
});

@@ -203,0 +224,0 @@

{
"name": "react-inlinesvg",
"version": "0.1.2",
"version": "0.1.3",
"description": "An SVG loader for React",

@@ -10,3 +10,4 @@ "main": "./lib/index.js",

"dependencies": {
"once": "~1.3.0"
"once": "~1.3.0",
"urllite": "~0.4.1"
},

@@ -13,0 +14,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc