mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
LibWeb: Support CSSStyleDeclaration.getPropertyPriority()
This commit is contained in:
parent
a8afb883c1
commit
a0ba49a50a
3 changed files with 14 additions and 0 deletions
|
@ -177,6 +177,18 @@ String CSSStyleDeclaration::get_property_value(StringView property_name) const
|
|||
return maybe_property->value->to_string();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority
|
||||
String CSSStyleDeclaration::get_property_priority(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->important == Important::Yes ? "important" : "";
|
||||
}
|
||||
|
||||
DOM::ExceptionOr<void> CSSStyleDeclaration::set_property(StringView property_name, StringView css_text, StringView priority)
|
||||
{
|
||||
auto property_id = property_id_from_string(property_name);
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
DOM::ExceptionOr<String> remove_property(StringView property_name);
|
||||
|
||||
String get_property_value(StringView property) const;
|
||||
String get_property_priority(StringView property) const;
|
||||
|
||||
String css_text() const;
|
||||
void set_css_text(StringView);
|
||||
|
|
|
@ -5,6 +5,7 @@ interface CSSStyleDeclaration {
|
|||
CSSOMString item(unsigned long index);
|
||||
|
||||
CSSOMString getPropertyValue(CSSOMString property);
|
||||
CSSOMString getPropertyPriority(CSSOMString property);
|
||||
|
||||
[CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, [LegacyNullToEmptyString] optional CSSOMString priority = "");
|
||||
[CEReactions] CSSOMString removeProperty(CSSOMString property);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue