From df85832f3224ad9557f3b03cc00622dadd82abcb Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 15 Oct 2021 16:53:38 +0100 Subject: [PATCH] LibWeb: Implement CSSStyleRule::set_selector_text() --- Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp index ace2f9701c..d13324949c 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp @@ -5,6 +5,7 @@ */ #include +#include namespace Web::CSS { @@ -333,14 +334,14 @@ String CSSStyleRule::selector_text() const // https://drafts.csswg.org/cssom/#dom-cssstylerule-selectortext void CSSStyleRule::set_selector_text(StringView selector_text) { - // FIXME: 1. Run the parse a group of selectors algorithm on the given value. + // 1. Run the parse a group of selectors algorithm on the given value. + auto parsed_selectors = parse_selector({}, selector_text); - // FIXME: 2. If the algorithm returns a non-null value replace the associated group of selectors with the returned value. + // 2. If the algorithm returns a non-null value replace the associated group of selectors with the returned value. + if (parsed_selectors.has_value()) + m_selectors = parsed_selectors.release_value(); - // FIXME: 3. Otherwise, if the algorithm returns a null value, do nothing. - - (void)selector_text; - TODO(); + // 3. Otherwise, if the algorithm returns a null value, do nothing. } }