Truly independent web browser
LibWeb: Avoid style updates for empty Typed OM appends
Andreas Klingd27fde62ea89
diff --git a/Libraries/LibWeb/CSS/StylePropertyMap.cpp b/Libraries/LibWeb/CSS/StylePropertyMap.cppindex 07700d6ce84..c03ecddebf9 100644--- a/Libraries/LibWeb/CSS/StylePropertyMap.cpp+++ b/Libraries/LibWeb/CSS/StylePropertyMap.cpp@@ -315,6 +315,10 @@ WebIDL::ExceptionOr<void> StylePropertyMap::append(Utf16FlyString property_name,return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, Utf16String::formatted("Existing value for '{}' contains var() references.", property_name) };}+ // NB: Appending no values must not replace the declaration or update the style attribute.+ if (values.is_empty())+ return {};+// 9. Let temp values be an empty list.// NB: StyleValues are immutable, so we always create a new one. We add directly to it instead of using "temp values".StyleValueVector value_list;diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txtindex 77fa8f3e17a..f14d7e27566 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txt@@ -2,14 +2,13 @@ Harness status: OKFound 11 tests-10 Pass-1 Fail+11 PassPass attributeStyleMap.set() triggers attributeChangedCallbackPass attributeStyleMap.set() triggers attributeChangedCallback with correct old/new valuesPass attributeStyleMap.delete() triggers attributeChangedCallbackPass attributeStyleMap.clear() triggers attributeChangedCallbackPass attributeStyleMap.append() triggers attributeChangedCallback-Fail attributeStyleMap.append() with no values does not trigger attributeChangedCallback+Pass attributeStyleMap.append() with no values does not trigger attributeChangedCallbackPass attributeStyleMap.set() with custom property triggers attributeChangedCallbackPass attributeStyleMap.delete() with custom property triggers attributeChangedCallbackPass attributeStyleMap.set() with shorthand property triggers attributeChangedCallback