Bug 1287321 - Don't fire input event on type=range when value hasn't changed. r=baku

This commit is contained in:
Olli Pettay
2016-07-20 21:06:57 +03:00
parent c81f8b6029
commit 9ce8cf846c
3 changed files with 67 additions and 4 deletions

View File

@@ -3902,6 +3902,8 @@ HTMLInputElement::SetValueOfRangeForUserEvent(Decimal aValue)
{
MOZ_ASSERT(aValue.isFinite());
Decimal oldValue = GetValueAsDecimal();
nsAutoString val;
ConvertNumberToString(aValue, val);
// TODO: What should we do if SetValueInternal fails? (The allocation
@@ -3912,10 +3914,13 @@ HTMLInputElement::SetValueOfRangeForUserEvent(Decimal aValue)
if (frame) {
frame->UpdateForValueChange();
}
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIDOMHTMLInputElement*>(this),
NS_LITERAL_STRING("input"), true,
false);
if (GetValueAsDecimal() != oldValue) {
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIDOMHTMLInputElement*>(this),
NS_LITERAL_STRING("input"), true,
false);
}
}
void