Bug 1675894 - Fire selectionchange from disconnected text controls r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D98810
This commit is contained in:
@@ -2098,10 +2098,19 @@ void TextControlState::SetSelectionRange(
|
||||
|
||||
if (changed) {
|
||||
// It sure would be nice if we had an existing Element* or so to work with.
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(mTextCtrlElement, u"select"_ns,
|
||||
CanBubble::eYes, ChromeOnlyDispatch::eNo);
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
|
||||
mTextCtrlElement, eFormSelect, CanBubble::eYes);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
|
||||
// SelectionChangeEventDispatcher covers this when !IsSelectionCached().
|
||||
// XXX(krosylight): Shouldn't it fire before select event?
|
||||
// Currently Gecko and Blink both fire selectionchange after select.
|
||||
if (IsSelectionCached() &&
|
||||
StaticPrefs::dom_select_events_textcontrols_enabled()) {
|
||||
asyncDispatcher = new AsyncEventDispatcher(
|
||||
mTextCtrlElement, eSelectionChange, CanBubble::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
|
||||
Reference in New Issue
Block a user