Bug 1345606. setRangeText should mark the text control as dirty. r=ehsan
MozReview-Commit-ID: 9le2PoelGei
This commit is contained in:
@@ -6320,7 +6320,9 @@ HTMLInputElement::GetValueFromSetRangeText(nsAString& aValue)
|
|||||||
nsresult
|
nsresult
|
||||||
HTMLInputElement::SetValueFromSetRangeText(const nsAString& aValue)
|
HTMLInputElement::SetValueFromSetRangeText(const nsAString& aValue)
|
||||||
{
|
{
|
||||||
return SetValueInternal(aValue, nsTextEditorState::eSetValue_ByContent);
|
return SetValueInternal(aValue,
|
||||||
|
nsTextEditorState::eSetValue_ByContent |
|
||||||
|
nsTextEditorState::eSetValue_Notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nullable<uint32_t>
|
Nullable<uint32_t>
|
||||||
|
|||||||
@@ -784,7 +784,9 @@ HTMLTextAreaElement::GetValueFromSetRangeText(nsAString& aValue)
|
|||||||
nsresult
|
nsresult
|
||||||
HTMLTextAreaElement::SetValueFromSetRangeText(const nsAString& aValue)
|
HTMLTextAreaElement::SetValueFromSetRangeText(const nsAString& aValue)
|
||||||
{
|
{
|
||||||
return SetValueInternal(aValue, nsTextEditorState::eSetValue_ByContent);
|
return SetValueInternal(aValue,
|
||||||
|
nsTextEditorState::eSetValue_ByContent |
|
||||||
|
nsTextEditorState::eSetValue_Notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -200,4 +200,20 @@ for (var data of elemData) {
|
|||||||
}, `selection location after defaultValue set to shorter than selectionStart of ${data.desc}`);
|
}, `selection location after defaultValue set to shorter than selectionStart of ${data.desc}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var data of elemData) {
|
||||||
|
test(function() {
|
||||||
|
var el = data.factory();
|
||||||
|
this.add_cleanup(() => el.remove());
|
||||||
|
el.defaultValue = sometext;
|
||||||
|
assert_true(sometext.length > 8,
|
||||||
|
"sometext too short, test won't work right");
|
||||||
|
el.selectionStart = 4;
|
||||||
|
el.selectionEnd = 6;
|
||||||
|
el.setRangeText("xyz");
|
||||||
|
el.defaultValue = "set range text";
|
||||||
|
assert_equals(el.value, sometext.slice(0, 4) + "xyz" + sometext.slice(6),
|
||||||
|
"Calling setRangeText should set the value dirty flag");
|
||||||
|
}, `value dirty flag behavior after setRangeText on ${data.desc}`);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user