Skip to content

Commit

Permalink
Apply @spicyj's SelectEventPlugin fix
Browse files Browse the repository at this point in the history
This fixes some tests with Fiber since we no longer rely on Stack
internals for this.
  • Loading branch information
sebmarkbage committed Nov 18, 2016
1 parent 632ae80 commit 6e04bd7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/renderers/dom/shared/eventPlugins/SelectEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ var getActiveElement = require('getActiveElement');
var isTextInputElement = require('isTextInputElement');
var shallowEqual = require('shallowEqual');

// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
var DOC_FRAGMENT_TYPE = 11;

var skipSelectionChangeEvent = (
ExecutionEnvironment.canUseDOM &&
'documentMode' in document &&
Expand Down Expand Up @@ -159,13 +156,13 @@ var SelectEventPlugin = {
nativeEvent,
nativeEventTarget
) {
if (targetInst) {
var containerInfo = targetInst._hostContainerInfo;
var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
if (!isListeningToAllDependencies('onSelect', doc)) {
return null;
}
var doc = nativeEventTarget.window === nativeEventTarget ?
nativeEventTarget.document :
nativeEventTarget.nodeType === 9 ?
nativeEventTarget :
nativeEventTarget.ownerDocument;
if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
return null;
}

var targetNode = targetInst ?
Expand Down

0 comments on commit 6e04bd7

Please sign in to comment.