diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-10 20:52:58 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-10 20:52:58 +0100 |
commit | 05eb68d45200e4e14bcc4aa1c735ce43aa573f07 (patch) | |
tree | 324d015927cf1f7e8b95d069ae041abe8a830dd6 /Userland/Libraries/LibWeb | |
parent | b68c51379eb300c840f0961c86e18f9f2edb9a36 (diff) | |
download | serenity-05eb68d45200e4e14bcc4aa1c735ce43aa573f07.zip |
LibWeb: Make :root selector match <html> element only
We were matching every HTML element, instead of just the root (<html>)
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 98a5b76ead..d897578b08 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org> * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause @@ -11,7 +11,7 @@ #include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Text.h> #include <LibWeb/HTML/AttributeNames.h> -#include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/HTMLHtmlElement.h> namespace Web::SelectorEngine { @@ -77,7 +77,7 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla case CSS::Selector::SimpleSelector::PseudoClass::Type::Empty: return !(element.first_child_of_type<DOM::Element>() || element.first_child_of_type<DOM::Text>()); case CSS::Selector::SimpleSelector::PseudoClass::Type::Root: - return is<HTML::HTMLElement>(element); + return is<HTML::HTMLHtmlElement>(element); case CSS::Selector::SimpleSelector::PseudoClass::Type::FirstOfType: for (auto* sibling = element.previous_element_sibling(); sibling; sibling = sibling->previous_element_sibling()) { if (sibling->tag_name() == element.tag_name()) |