Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Fix when anchorNode is undefined instead of null #1407

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally prefer to be more specific when checking for a value to be defined, but in this case we don't want any other falsy JS values either, so I think this is ok.

nativeSelection.anchorNode.nodeType === Node.TEXT_NODE
) {
// See isTabHTMLSpanElement in chromium EditingUtilities.cpp.
Expand Down