Closed Bug 1712255 Opened 3 years ago Closed 3 years ago

setRangeText does not fire select event from disconnected text controls

Categories

(Core :: DOM: Selection, defect)

defect

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

var element = document.createElement("input");
element.value = "foo ".repeat(10);
element.onselect = console.log;
element.setSelectionRange(0, 100);
element.setRangeText("", 10, 12);

Expected: Two select events
Actual: One select event

Capping selection range in SetValue early makes the subsequent SetSelectionRange call unable to detect actual selection range change. This patch defers it so that select events can be consistently fired.

Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d97093bef691 Defer SetMaxLength in SetValueFromSetRangeText r=masayuki
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/29088 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: