1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

LibWeb: Treat null as empty string in CSSStyleDeclaration::internal_set

Spec defines `[LegacyNullToEmptyString]` on `value` argument of
`setProperty` but since `internal_set` calls `setProperty` directly
instead of using IDL generated binding, we need to make sure that null
is treated as empty string.

Fixes items grid loading on https://d.rsms.me/stuff/
This commit is contained in:
Aliaksandr Kalenik 2024-01-21 20:00:52 +01:00 committed by Andreas Kling
parent e9e1ee11d4
commit 7e2308d290
3 changed files with 19 additions and 1 deletions

View file

@ -432,7 +432,7 @@ JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_set(JS::PropertyKey co
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_set(name, value, receiver, cacheable_metadata);
auto css_text = TRY(value.to_string(vm));
auto css_text = value.is_null() ? String {} : TRY(value.to_string(vm));
TRY(Bindings::throw_dom_exception_if_needed(vm, [&] { return set_property(property_id, css_text); }));
return true;