dillon1000/react
Commit
Browse files Add new textChange event: input + IE shim
IE8 doesn't support oninput and IE9 supports it badly but we can do almost a perfect shim by listening to a handful of different events (focus, blur, propertychange, selectionchange, keyup, keydown). This always triggers event handlers during the browser's event loop (not later in a setTimeout) and after the value property has been updated. The only case I know of where this doesn't fire the event immediately is if (in IE8) you modify the input value using JS and then the user does a key repeat, in which case we fire the event on the second keydown. Test Plan: Modify ballmer-peak example to add es5-shim and to use onTextChange instead of onInput. In IE8, IE9, and latest Chrome, make sure that the event is fired upon: * typing normally, * backspacing, * forward-deleting, * cutting, * pasting, * context-menu deleting, * dragging text to reorder characters. After modifying the example to change .value, make sure that the event is not fired as a result of the changes from JS (even when the input box is focused).
Changed paths5 files
First-parent comparisonsrc/core/ReactDefaultInjection.js ModifiedM src/core/ReactEventEmitter.js ModifiedM src/event/EventConstants.js ModifiedM src/eventPlugins/DefaultEventPluginOrder.js ModifiedA src/eventPlugins/TextChangeEventPlugin.js AddedPatch
Files changed
Rendering syntax-highlighted changes…