Return the old attribute value when swapping even if it has a namespace.

Currently this will always "swap" the value with NULL since it gets reset,
and the element's SetAttrAndNotify uses the swapped value as the oldValue for
mutation observer notifications, so it's always NULL, which does not match IE.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2024-02-19 18:31:08 +02:00
parent 72fa55dea9
commit e922a71604
No known key found for this signature in database
GPG Key ID: 4CEE4FF41CC69382

View File

@ -427,7 +427,6 @@ nsAttrAndChildArray::SetAndSwapAttr(mozilla::dom::NodeInfo* aName, nsAttrValue&
for (i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
if (ATTRS(mImpl)[i].mName.Equals(localName, namespaceID)) {
ATTRS(mImpl)[i].mName.SetTo(aName);
ATTRS(mImpl)[i].mValue.Reset();
ATTRS(mImpl)[i].mValue.SwapValueWith(aValue);
return NS_OK;