Skip to content

Commit

Permalink
Fix when anchorNode is undefined instead of null
Browse files Browse the repository at this point in the history
Summary:
Fixes #1399

`nativeSelection.anchorNode` can be undefined instead of null, so I'm changing the condition to handle this use case.
Closes facebookarchive/draft-js#1407

Differential Revision: D5974852

fbshipit-source-id: bb24ba0e3bf041530bdbea555f26e61d2b33022f
  • Loading branch information
midas19910709 committed Oct 4, 2017
1 parent ad4394d commit 8e0e400
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/component/handlers/edit/editOnBeforeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function editOnBeforeInput(
const nativeSelection = global.getSelection();
// Selection is necessarily collapsed at this point due to earlier check.
if (
nativeSelection.anchorNode !== null &&
nativeSelection.anchorNode &&
nativeSelection.anchorNode.nodeType === Node.TEXT_NODE
) {
// See isTabHTMLSpanElement in chromium EditingUtilities.cpp.
Expand Down

0 comments on commit 8e0e400

Please sign in to comment.