MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getTargetInstForInputEventPolyfill

Function getTargetInstForInputEventPolyfill

code/styling/public/app.js:4805–4819  ·  view source on GitHub ↗
(topLevelType, targetInst)

Source from the content-addressed store, hash-verified

4803
4804// For IE8 and IE9.
4805function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
4806 if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
4807 // On the selectionchange event, the target is just document which isn't
4808 // helpful for us so just check activeElement instead.
4809 //
4810 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
4811 // propertychange on the first input event after setting `value` from a
4812 // script and fires only keydown, keypress, keyup. Catching keyup usually
4813 // gets it and catching keydown lets us fire an event for the first
4814 // keystroke if user does a key repeat (it'll be a little delayed: right
4815 // before the second keystroke). Other input methods (e.g., paste) seem to
4816 // fire selectionchange normally.
4817 return getInstIfValueChanged(activeElementInst);
4818 }
4819}
4820
4821/**
4822 * SECTION: handle `click` event

Callers

nothing calls this directly

Calls 1

getInstIfValueChangedFunction · 0.70

Tested by

no test coverage detected