Bug 223877

Summary: HTMLInputElement.setRangeText does not update text value if HTMLInputElement is disconnected
Product: WebKit Reporter: Diego Pino <dpino>
Component: DOMAssignee: Diego Pino <dpino>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=237720

Description Diego Pino 2021-03-29 00:16:14 PDT
HTMLInputElement.setRangeText does not update text value
Comment 1 Chris Dumez 2021-03-29 12:50:42 PDT
Would you be able to provide a reproduction case?
Comment 2 Diego Pino 2021-03-31 19:08:48 PDT
(In reply to Chris Dumez from comment #1)
> Would you be able to provide a reproduction case?

It seems it doesn't happen in all cases. It happens when an HTMLInputElement or HTMLTextAreaElement are disconnected.

There are actually two LayoutTests that already test this case:

* fast/forms/setrangetext.html
* imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-value-interactions.html

LayoutTests/fast/forms/setrangetext-expected.txt

Check that setRangeText() on disconnected elements doesn't crash and has proper values.
element.value = '0123456789'
element.setRangeText('ABC', 0, 0, 'select')
FAIL element.value should be ABC0123456789. Was 0123456789.

LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-value-interactions-expected.txt

FAIL value dirty flag behavior after setRangeText on textarea not in body assert_equals: Calling setRangeText should set the value dirty flag expected "somexyzing" but got "set range text"
FAIL value dirty flag behavior after setRangeText on input not in body assert_equals: Calling setRangeText should set the value dirty flag expected "somexyzing" but got "set range text"
Comment 3 Radar WebKit Bug Importer 2021-04-05 00:17:15 PDT
<rdar://problem/76207934>
Comment 4 Diego Pino 2022-07-19 21:05:39 PDT
Fixed by https://bugs.webkit.org/show_bug.cgi?id=237720.