Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a811f8d9e6ff1508488ef0fb8b117105dbfe0390
https://github.com/WebKit/WebKit/commit/a811f8d9e6ff1508488ef0fb8b117105dbfe0390
Author: Chris Dumez <[email protected]>
Date: 2026-06-05 (Fri, 05 Jun 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity.html
M Source/WebCore/dom/MutationObserver.cpp
Log Message:
-----------
MutationObserver.observe() incorrectly throws when attributeOldValue or
characterDataOldValue is present with value false
https://bugs.webkit.org/show_bug.cgi?id=316382
Reviewed by Ryosuke Niwa.
Per https://dom.spec.whatwg.org/#dom-mutationobserver-observe, if either
attributeOldValue or attributeFilter is *present* in the init dictionary
and attributes is omitted, attributes is set to true. The same applies to
characterDataOldValue and characterData. "Present" here means the
dictionary key was provided, regardless of its value.
WebKit was conflating presence with truthiness: AttributeOldValue /
CharacterDataOldValue option flags were only added when the value was
true, and the auto-set step keyed off those flags rather than off
presence. As a result, observe(node, { attributeOldValue: false }) — and
likewise for characterDataOldValue: false — incorrectly threw a
TypeError instead of registering an attribute observer with no
old-value delivery.
Use std::optional::has_value() to test presence in the auto-set step,
matching Blink & Gecko's behavior and the spec.
Test: imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity.html
*
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity.html:
* Source/WebCore/dom/MutationObserver.cpp:
(WebCore::MutationObserver::observe):
Canonical link: https://commits.webkit.org/314623@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications