mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibWeb: Implement CSS declaration block's "updating flag"
This flag is used to prevent reparsing the style attribute after it is automatically updated after using the CSSOM API to mutate style.
This commit is contained in:
parent
66618a666b
commit
a8afb883c1
4 changed files with 27 additions and 2 deletions
|
@ -125,10 +125,22 @@ DOM::ExceptionOr<String> PropertyOwningCSSStyleDeclaration::remove_property(Prop
|
|||
// https://drafts.csswg.org/cssom/#update-style-attribute-for
|
||||
void ElementInlineCSSStyleDeclaration::update_style_attribute()
|
||||
{
|
||||
// 1. Assert: declaration block’s computed flag is unset.
|
||||
// NOTE: Unnecessary, only relevant for ResolvedCSSStyleDeclaration.
|
||||
|
||||
// 2. Let owner node be declaration block’s owner node.
|
||||
// 3. If owner node is null, then return.
|
||||
if (!m_element)
|
||||
return;
|
||||
|
||||
// 4. Set declaration block’s updating flag.
|
||||
m_updating = true;
|
||||
|
||||
// 5. Set an attribute value for owner node using "style" and the result of serializing declaration block.
|
||||
m_element->set_attribute(HTML::AttributeNames::style, serialized());
|
||||
|
||||
// 6. Unset declaration block’s updating flag.
|
||||
m_updating = false;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#set-a-css-declaration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue