mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +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:
parent
33e4a35d2d
commit
08cf35cf9a
2 changed files with 5 additions and 1 deletions
|
@ -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
|
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())
|
if (!name.is_string())
|
||||||
return Base::internal_get(name, receiver, cacheable_metadata);
|
return Base::internal_get(name, receiver, cacheable_metadata);
|
||||||
auto property_id = property_id_from_name(name.to_string());
|
auto property_id = property_id_from_name(name.to_string());
|
||||||
|
|
|
@ -5,7 +5,7 @@ interface CSSStyleDeclaration {
|
||||||
[CEReactions] attribute CSSOMString cssText;
|
[CEReactions] attribute CSSOMString cssText;
|
||||||
|
|
||||||
readonly attribute unsigned long length;
|
readonly attribute unsigned long length;
|
||||||
CSSOMString item(unsigned long index);
|
getter CSSOMString item(unsigned long index);
|
||||||
|
|
||||||
CSSOMString getPropertyValue(CSSOMString property);
|
CSSOMString getPropertyValue(CSSOMString property);
|
||||||
CSSOMString getPropertyPriority(CSSOMString property);
|
CSSOMString getPropertyPriority(CSSOMString property);
|
||||||
|
@ -13,4 +13,6 @@ interface CSSStyleDeclaration {
|
||||||
[CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = "");
|
[CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = "");
|
||||||
[CEReactions] CSSOMString removeProperty(CSSOMString property);
|
[CEReactions] CSSOMString removeProperty(CSSOMString property);
|
||||||
|
|
||||||
|
// FIXME: readonly attribute CSSRule? parentRule;
|
||||||
|
// FIXME: [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString cssFloat;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue