mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibWeb: Update existing style object when setting style attribute
Previously any existing ElementInlineCSSStyleDeclaration would get overwritten by e.setAttribute("style", ...), while it should be updated instead. This fixes 2 WPT subtests.
This commit is contained in:
parent
be3a941f44
commit
aa33acf3a2
Notes:
github-actions[bot]
2024-11-25 16:18:19 +00:00
Author: https://github.com/milotier
Commit: aa33acf3a2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2571
4 changed files with 25 additions and 9 deletions
|
@ -2740,7 +2740,12 @@ void Element::attribute_changed(FlyString const& local_name, Optional<String> co
|
|||
// https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-updating-flag
|
||||
if (m_inline_style && m_inline_style->is_updating())
|
||||
return;
|
||||
m_inline_style = parse_css_style_attribute(CSS::Parser::ParsingContext(document()), *value, *this);
|
||||
if (!m_inline_style) {
|
||||
m_inline_style = parse_css_style_attribute(CSS::Parser::ParsingContext(document()), *value, *this);
|
||||
} else {
|
||||
// NOTE: ElementInlineCSSStyleDeclaration::set_css_text should never throw an exception.
|
||||
m_inline_style->set_declarations_from_text(*value);
|
||||
}
|
||||
set_needs_style_update(true);
|
||||
}
|
||||
} else if (local_name == HTML::AttributeNames::dir) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue