1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibWeb: Make CSSStyleDeclaration.camelCaseProperty work :^)

This resolves a long-standing FIXME about exposing CSS properties to
JavaScript via "camelCase" names rather than "dash-separated" names.
This commit is contained in:
Andreas Kling 2021-09-29 20:31:01 +02:00
parent dadb92a155
commit f53d0ddba2

View file

@ -13,8 +13,7 @@ bool CSSStyleDeclarationWrapper::internal_has_property(JS::PropertyName const& n
{
if (!name.is_string())
return Base::internal_has_property(name);
// FIXME: These should actually use camelCase versions of the property names!
auto property_id = CSS::property_id_from_string(name.to_string());
auto property_id = CSS::property_id_from_camel_case_string(name.to_string());
return property_id != CSS::PropertyID::Invalid;
}
@ -22,8 +21,7 @@ JS::Value CSSStyleDeclarationWrapper::internal_get(JS::PropertyName const& name,
{
if (!name.is_string())
return Base::internal_get(name, receiver);
// FIXME: These should actually use camelCase versions of the property names!
auto property_id = CSS::property_id_from_string(name.to_string());
auto property_id = CSS::property_id_from_camel_case_string(name.to_string());
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_get(name, receiver);
if (auto maybe_property = impl().property(property_id); maybe_property.has_value())
@ -35,8 +33,7 @@ bool CSSStyleDeclarationWrapper::internal_set(JS::PropertyName const& name, JS::
{
if (!name.is_string())
return Base::internal_set(name, value, receiver);
// FIXME: These should actually use camelCase versions of the property names!
auto property_id = CSS::property_id_from_string(name.to_string());
auto property_id = CSS::property_id_from_camel_case_string(name.to_string());
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_set(name, value, receiver);