зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1895551 - Remove aria attribute from ElementInternals when set to null. r=Jamie,dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D209721
This commit is contained in:
Родитель
d795febb58
Коммит
3357f914c8
|
@ -213,6 +213,13 @@ async function runTest() {
|
|||
await attributeChanged;
|
||||
testAttrs("default-sort", {"sort": "descending"}, true);
|
||||
|
||||
info("Changing ElementInternals ariaValueText");
|
||||
let valueTextChanged = waitForEvent(EVENT_TEXT_VALUE_CHANGE, "default-value");
|
||||
let valueElement = document.getElementById("default-value");
|
||||
valueElement.internals.ariaValueText = null;
|
||||
await valueTextChanged;
|
||||
testValue("default-value", "5", 5, 1, 10, 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -451,9 +451,17 @@ nsresult ElementInternals::SetAttr(nsAtom* aName, const nsAString& aValue) {
|
|||
MutationObservers::NotifyARIAAttributeDefaultWillChange(mTarget, aName,
|
||||
modType);
|
||||
|
||||
bool attrHadValue;
|
||||
nsAttrValue attrValue(aValue);
|
||||
nsresult rs = mAttrs.SetAndSwapAttr(aName, attrValue, &attrHadValue);
|
||||
nsresult rs = NS_OK;
|
||||
if (DOMStringIsNull(aValue)) {
|
||||
auto attrPos = mAttrs.IndexOfAttr(aName);
|
||||
if (attrPos >= 0) {
|
||||
rs = mAttrs.RemoveAttrAt(attrPos, attrValue);
|
||||
}
|
||||
} else {
|
||||
bool attrHadValue = false;
|
||||
rs = mAttrs.SetAndSwapAttr(aName, attrValue, &attrHadValue);
|
||||
}
|
||||
nsMutationGuard::DidMutate();
|
||||
|
||||
MutationObservers::NotifyARIAAttributeDefaultChanged(mTarget, aName, modType);
|
||||
|
|
Загрузка…
Ссылка в новой задаче