mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-21 07:06:04 +00:00
LibWeb: Implement CSSStyleDeclaration.{set,remove}Property close to spec
We already had setProperty() but it was full of ad-hoc idiosyncracies. This patch aligns setProperty() with the CSSOM spec and also implements removeProperty() since that's actually needed by setProperty() now. Some things fixed by this: - We now support the "priority" parameter to setProperty() - Element "style" attributes now update to reflect CSSOM mutations
This commit is contained in:
@@ -800,9 +800,18 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
|
||||
};
|
||||
}
|
||||
|
||||
bool ResolvedCSSStyleDeclaration::set_property(PropertyID, StringView)
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty
|
||||
DOM::ExceptionOr<void> ResolvedCSSStyleDeclaration::set_property(PropertyID, StringView, StringView)
|
||||
{
|
||||
return false;
|
||||
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
|
||||
return DOM::NoModificationAllowedError::create("Cannot modify properties in result of getComputedStyle()");
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty
|
||||
DOM::ExceptionOr<String> ResolvedCSSStyleDeclaration::remove_property(PropertyID)
|
||||
{
|
||||
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
|
||||
return DOM::NoModificationAllowedError::create("Cannot remove properties from result of getComputedStyle()");
|
||||
}
|
||||
|
||||
String ResolvedCSSStyleDeclaration::serialized() const
|
||||
|
||||
Reference in New Issue
Block a user