@samitouri / QOS-React-2 / commits / 292dd238e7
Fork 0

The library for web and native user interfaces.

Add new onInput event

'input' is supported in IE9+ and all other browsers according to https://developer.mozilla.org/en-US/docs/Web/API/window.oninput Test Plan: Modified ballmer-peak example to use onInput instead of onKeyUp and tested that it works properly on latest Chrome.

Ben Alpert committed May 30, 2013 at 18:14 UTC 292dd238e70400a16bebd000fc4364c42d3effe7
3 files changed +9
src/core/ReactEvent.js
+1
@@ -211,6 +211,7 @@ function listenAtTopLevel(touchNotMouse) {
211 trapBubbledEvent(topLevelTypes.topKeyUp, 'keyup', mountAt);
212 trapBubbledEvent(topLevelTypes.topKeyPress, 'keypress', mountAt);
213 trapBubbledEvent(topLevelTypes.topKeyDown, 'keydown', mountAt);
214 + trapBubbledEvent(topLevelTypes.topInput, 'input', mountAt);
215 trapBubbledEvent(topLevelTypes.topChange, 'change', mountAt);
216 trapBubbledEvent(
217 topLevelTypes.topDOMCharacterDataModified,
src/event/EventConstants.js
+1
@@ -32,6 +32,7 @@ var topLevelTypes = keyMirror({
32 topDOMCharacterDataModified: null,
33 topDoubleClick: null,
34 topFocus: null,
35 + topInput: null,
36 topKeyDown: null,
37 topKeyPress: null,
38 topKeyUp: null,
src/eventPlugins/SimpleEventPlugin.js
+7
@@ -108,6 +108,12 @@ var SimpleEventPlugin = {
108 captured: keyOf({onKeyDownCapture: true})
109 }
110 },
111 + input: {
112 + phasedRegistrationNames: {
113 + bubbled: keyOf({onInput: true}),
114 + captured: keyOf({onInputCapture: true})
115 + }
116 + },
117 focus: {
118 phasedRegistrationNames: {
119 bubbled: keyOf({onFocus: true}),
@@ -220,6 +226,7 @@ SimpleEventPlugin.topLevelTypesToAbstract = {
226 topKeyUp: SimpleEventPlugin.abstractEventTypes.keyUp,
227 topKeyPress: SimpleEventPlugin.abstractEventTypes.keyPress,
228 topKeyDown: SimpleEventPlugin.abstractEventTypes.keyDown,
229 + topInput: SimpleEventPlugin.abstractEventTypes.input,
230 topFocus: SimpleEventPlugin.abstractEventTypes.focus,
231 topBlur: SimpleEventPlugin.abstractEventTypes.blur,
232 topScroll: SimpleEventPlugin.abstractEventTypes.scroll,