LibWeb: Use is_ascii_case_insensitive_match() where the spec says to

This commit is contained in:
Sam Atkins 2023-02-17 15:21:32 +00:00 committed by Linus Groh
parent f0b72b819e
commit 2026ea557e
Notes: sideshowbarker 2024-07-17 00:04:12 +09:00
10 changed files with 59 additions and 44 deletions

View file

@ -8,6 +8,7 @@
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/HTMLStyleElement.h>
#include <LibWeb/Infra/Strings.h>
namespace Web::HTML {
@ -131,7 +132,7 @@ void HTMLStyleElement::update_a_style_block()
// 4. If element's type attribute is present and its value is neither the empty string nor an ASCII case-insensitive match for "text/css", then return.
auto type_attribute = attribute(HTML::AttributeNames::type);
if (!type_attribute.is_null() && !type_attribute.is_empty() && !type_attribute.equals_ignoring_case("text/css"sv))
if (!type_attribute.is_null() && !type_attribute.is_empty() && !Infra::is_ascii_case_insensitive_match(type_attribute, "text/css"sv))
return;
// FIXME: 5. If the Should element's inline behavior be blocked by Content Security Policy? algorithm returns "Blocked" when executed upon the style element, "style", and the style element's child text content, then return. [CSP]