mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Use onSelect fallback in IE
In response to https://github.com/facebook/react/issues/2722. Use the Firefox selection change fallback for IE.
This commit is contained in:
1 parent
c97ed7b804
commit
2ff7512975
1 file changed
+14
-1
@@ -13,6 +13,7 @@
|
||||
|
||||
var EventConstants = require('EventConstants');
|
||||
var EventPropagators = require('EventPropagators');
|
||||
var ExecutionEnvironment = require('ExecutionEnvironment');
|
||||
var ReactInputSelection = require('ReactInputSelection');
|
||||
var SyntheticEvent = require('SyntheticEvent');
|
||||
|
||||
@@ -23,6 +24,12 @@ var shallowEqual = require('shallowEqual');
|
||||
|
||||
var topLevelTypes = EventConstants.topLevelTypes;
|
||||
|
||||
var skipSelectionChangeEvent = (
|
||||
ExecutionEnvironment.canUseDOM &&
|
||||
'documentMode' in document &&
|
||||
document.documentMode <= 11
|
||||
);
|
||||
|
||||
var eventTypes = {
|
||||
select: {
|
||||
phasedRegistrationNames: {
|
||||
@@ -189,12 +196,18 @@ var SelectEventPlugin = {
|
||||
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
||||
|
||||
// Chrome and IE fire non-standard event when selection is changed (and
|
||||
// sometimes when it hasn't).
|
||||
// sometimes when it hasn't). IE's event fires out of order with respect
|
||||
// to key and input events on deletion, so we discard it.
|
||||
//
|
||||
// Firefox doesn't support selectionchange, so check selection status
|
||||
// after each key entry. The selection changes after keydown and before
|
||||
// keyup, but we check on keydown as well in the case of holding down a
|
||||
// key, when multiple keydown events are fired but only one keyup is.
|
||||
// This is also our approach for IE handling, for the reason above.
|
||||
case topLevelTypes.topSelectionChange:
|
||||
if (skipSelectionChangeEvent) {
|
||||
break;
|
||||
}
|
||||
case topLevelTypes.topKeyDown:
|
||||
case topLevelTypes.topKeyUp:
|
||||
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
||||
|
||||
Reference in new issue
Block a user