Drop workaround for object.onLoad

https://github.com/facebook/react/pull/5781 has been fixed in React 15.0, so
drop our workaroud for it.
This commit is contained in:
Richard van der Hoff 2016-04-17 21:46:27 +01:00
parent 3cde22169e
commit 716eb1eb1b

View file

@ -43,14 +43,10 @@ var TintableSvg = React.createClass({
componentDidMount: function() { componentDidMount: function() {
this.id = TintableSvg.idSequence++; this.id = TintableSvg.idSequence++;
TintableSvg.mounts[this.id] = this; TintableSvg.mounts[this.id] = this;
// we can't use onLoad on object due to https://github.com/facebook/react/pull/5781
// so handle it with pure DOM instead
ReactDOM.findDOMNode(this).addEventListener('load', this.onLoad);
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
delete TintableSvg.mounts[this.id]; delete TintableSvg.mounts[this.id];
ReactDOM.findDOMNode(this).removeEventListener('load', this.onLoad);
}, },
tint: function() { tint: function() {
@ -71,9 +67,11 @@ var TintableSvg = React.createClass({
type="image/svg+xml" type="image/svg+xml"
data={ this.props.src } data={ this.props.src }
width={ this.props.width } width={ this.props.width }
height={ this.props.height }/> height={ this.props.height }
onLoad={ this.onLoad }
/>
); );
} }
}); });
module.exports = TintableSvg; module.exports = TintableSvg;