Page MenuHomePhabricator

textSelection setContents doesn't work with empty string in Firefox
Closed, ResolvedPublicBUG REPORT

Description

The jQuery textSelection setContents method works to set the entire value of an element, e.g.:

$( '#wpTextbox1' ).textSelection( 'setContents', 'foo' );

However, this doesn't work in Firefox when setting the contents to the empty string:

$( '#wpTextbox1' ).textSelection( 'setContents', '' );

This looks like it's a bug with Firefox, and has been reported here: https://bugzilla.mozilla.org/show_bug.cgi?id=1858590

An example of that bug in action is here: https://codepen.io/freosam/pen/YzdgRGY

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
MusikAnimal subscribed.

Upstream bug now marked as resolved! https://hg.mozilla.org/mozilla-central/rev/edc283b2baad Good on you for reporting, Sam :)

I guess I'll move this to Following for now, until we verify a patched version of Firefox has shipped.

MusikAnimal assigned this task to Samwilson.

Seems to be working now in the latest Firefox.