LibWeb: Add style invalidation for :target, :focus, :active and :link

This commit is contained in:
Andreas Kling 2024-11-06 18:00:18 +01:00 committed by Andreas Kling
parent 1045000c28
commit 92d9907f8f
Notes: github-actions[bot] 2024-11-06 20:43:56 +00:00
9 changed files with 39 additions and 23 deletions

View file

@ -31,12 +31,14 @@ void HTMLHyperlinkElementUtils::set_the_url()
auto href_content_attribute = hyperlink_element_utils_href();
if (!href_content_attribute.has_value()) {
m_url = {};
hyperlink_element_utils_element().invalidate_style(DOM::StyleInvalidationReason::HTMLHyperlinkElementHrefChange);
return;
}
// 2. Otherwise, parse this element's href content attribute value relative to this element's node document.
// If parsing is successful, set this element's url to the result; otherwise, set this element's url to null.
m_url = hyperlink_element_utils_document().parse_url(*href_content_attribute);
hyperlink_element_utils_element().invalidate_style(DOM::StyleInvalidationReason::HTMLHyperlinkElementHrefChange);
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-origin