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

LibWeb: Allow indexing into CSSStyleDeclaration by number

The `item(unsigned long index)` method is marked as a getter in IDL, so
let's treat it as such.
This commit is contained in:
Sam Atkins 2023-09-29 16:48:28 +01:00 committed by Andreas Kling
parent 33e4a35d2d
commit 08cf35cf9a
2 changed files with 5 additions and 1 deletions

View file

@ -407,6 +407,8 @@ JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_has_property(JS::Prope
JS::ThrowCompletionOr<JS::Value> CSSStyleDeclaration::internal_get(JS::PropertyKey const& name, JS::Value receiver, JS::CacheablePropertyMetadata* cacheable_metadata) const
{
if (name.is_number())
return { JS::PrimitiveString::create(vm(), item(name.as_number())) };
if (!name.is_string())
return Base::internal_get(name, receiver, cacheable_metadata);
auto property_id = property_id_from_name(name.to_string());