Index: Source/core/html/HTMLTextFormControlElement.cpp |
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp |
index 274fec19b5ce1c3adc6b0872f6d8d129bc393204..2349df4143fd6f81182b8ddef1e4e7151d84ba94 100644 |
--- a/Source/core/html/HTMLTextFormControlElement.cpp |
+++ b/Source/core/html/HTMLTextFormControlElement.cpp |
@@ -348,7 +348,7 @@ static int indexForPosition(HTMLElement* innerEditor, const Position& passedPosi |
void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, SelectionOption selectionOption) |
{ |
- if (hasOpenShadowRoot() || !isTextFormControl()) |
+ if (hasOpenShadowRoot() || !isTextFormControl() || !inDocument()) |
return; |
const int editorValueLength = static_cast<int>(innerEditorValue().length()); |