mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add onError to ReactDOMImg to complement onLoad
This commit is contained in:
@@ -41,10 +41,16 @@ var ReactDOMImg = ReactCompositeComponent.createClass({
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
var node = this.getDOMNode();
|
||||
ReactEventEmitter.trapBubbledEvent(
|
||||
EventConstants.topLevelTypes.topLoad,
|
||||
'load',
|
||||
this.getDOMNode()
|
||||
node
|
||||
);
|
||||
ReactEventEmitter.trapBubbledEvent(
|
||||
EventConstants.topLevelTypes.topError,
|
||||
'error',
|
||||
node
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -157,6 +157,12 @@ var eventTypes = {
|
||||
captured: keyOf({onLoadCapture: true})
|
||||
}
|
||||
},
|
||||
error: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onError: true}),
|
||||
captured: keyOf({onErrorCapture: true})
|
||||
}
|
||||
},
|
||||
// Note: We do not allow listening to mouseOver events. Instead, use the
|
||||
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
|
||||
mouseDown: {
|
||||
@@ -260,6 +266,7 @@ var topLevelEventsToDispatchConfig = {
|
||||
topDragOver: eventTypes.dragOver,
|
||||
topDragStart: eventTypes.dragStart,
|
||||
topDrop: eventTypes.drop,
|
||||
topError: eventTypes.error,
|
||||
topFocus: eventTypes.focus,
|
||||
topInput: eventTypes.input,
|
||||
topKeyDown: eventTypes.keyDown,
|
||||
@@ -327,6 +334,7 @@ var SimpleEventPlugin = {
|
||||
switch (topLevelType) {
|
||||
case topLevelTypes.topInput:
|
||||
case topLevelTypes.topLoad:
|
||||
case topLevelTypes.topError:
|
||||
case topLevelTypes.topReset:
|
||||
case topLevelTypes.topSubmit:
|
||||
// HTML Events
|
||||
|
||||
@@ -44,6 +44,7 @@ var topLevelTypes = keyMirror({
|
||||
topDragOver: null,
|
||||
topDragStart: null,
|
||||
topDrop: null,
|
||||
topError: null,
|
||||
topFocus: null,
|
||||
topInput: null,
|
||||
topKeyDown: null,
|
||||
|
||||
Reference in New Issue
Block a user