LibWeb: Add style invalidation for :open pseudo-class

Add proper style invalidation when the `open` attribute changes on
HTMLDetailsElement and HTMLDialogElement. The :open pseudo-class can
affect sibling selectors (e.g., `dialog:open + sibling`), so we need
full subtree + sibling invalidation.
This commit is contained in:
Andreas Kling
2026-01-26 00:06:55 +01:00
committed by Andreas Kling
parent c0c8d35786
commit 5fc276872a
Notes: github-actions[bot] 2026-02-06 11:06:52 +00:00
4 changed files with 13 additions and 3 deletions

View File

@@ -675,6 +675,10 @@ void HTMLDialogElement::attribute_changed(FlyString const& local_name, Optional<
if (local_name != "open"_fly_string)
return;
// The :open pseudo-class can affect sibling selectors (e.g., dialog:open + sibling),
// so we need full subtree + sibling invalidation, not just targeted invalidation.
invalidate_style(DOM::StyleInvalidationReason::HTMLDetailsOrDialogOpenAttributeChange);
// 3. If value is null and oldValue is not null, then run the dialog cleanup steps given element.
if (!value.has_value() && old_value.has_value())
run_dialog_cleanup_steps();