react-svg
Advanced tools
Comparing version 2.1.7 to 2.1.8
@@ -13,2 +13,10 @@ 'use strict'; | ||
var _reactDom = require('react-dom'); | ||
var _reactDom2 = _interopRequireDefault(_reactDom); | ||
var _server = require('react-dom/server'); | ||
var _server2 = _interopRequireDefault(_server); | ||
var _svgInjector = require('svg-injector'); | ||
@@ -18,6 +26,2 @@ | ||
var _reactDom = require('react-dom'); | ||
var _reactDom2 = _interopRequireDefault(_reactDom); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -43,4 +47,2 @@ | ||
value: function renderSVG() { | ||
var _this2 = this; | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
@@ -56,17 +58,22 @@ var each = props.callback, | ||
_reactDom2.default.unstable_renderSubtreeIntoContainer(this, _react2.default.createElement('img', { | ||
ref: function ref(img) { | ||
_this2.img = img; | ||
}, | ||
var div = document.createElement('div'); | ||
div.innerHTML = _server2.default.renderToStaticMarkup(_react2.default.createElement('img', { | ||
className: className, | ||
'data-src': path, | ||
style: style | ||
}), this.container, function () { | ||
(0, _svgInjector2.default)(_this2.img, { | ||
evalScripts: evalScripts, | ||
each: each | ||
}); | ||
})); | ||
var img = this.container.appendChild(div.firstChild); | ||
(0, _svgInjector2.default)(img, { | ||
evalScripts: evalScripts, | ||
each: each | ||
}); | ||
} | ||
}, { | ||
key: 'removeSVG', | ||
value: function removeSVG() { | ||
this.container.removeChild(this.container.firstChild); | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
@@ -79,2 +86,3 @@ value: function componentDidMount() { | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.removeSVG(); | ||
this.renderSVG(nextProps); | ||
@@ -85,3 +93,3 @@ } | ||
value: function componentWillUnmount() { | ||
_reactDom2.default.unmountComponentAtNode(this.container); | ||
this.removeSVG(); | ||
} | ||
@@ -91,3 +99,3 @@ }, { | ||
value: function render() { | ||
return _react2.default.createElement('div'); | ||
return _react2.default.createElement('div', null); | ||
} | ||
@@ -94,0 +102,0 @@ }]); |
{ | ||
"name": "react-svg", | ||
"version": "2.1.7", | ||
"version": "2.1.8", | ||
"description": "A react.js svg component for loading svg files into the dom.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
828850
18187
63