1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 21:02:07 +00:00

LibWeb: Implement CSSStyleDeclaration.getPropertyValue(property)

This commit is contained in:
Andreas Kling 2021-09-12 20:44:17 +02:00
parent a72fd78713
commit a2f5589d3a
3 changed files with 15 additions and 0 deletions

View file

@ -91,4 +91,15 @@ bool PropertyOwningCSSStyleDeclaration::set_property(PropertyID property_id, Str
return true;
}
String CSSStyleDeclaration::get_property_value(StringView property_name) const
{
auto property_id = property_id_from_string(property_name);
if (property_id == CSS::PropertyID::Invalid)
return {};
auto maybe_property = property(property_id);
if (!maybe_property.has_value())
return {};
return maybe_property->value->to_string();
}
}