LibWeb: Use correct comparison logic in NamedNodeMap::get_attribute()

Previously, we were doing a case insensitive comparison, which could
return the wrong result if the attribute name was uppercase.
This commit is contained in:
Tim Ledbetter 2024-11-20 22:48:40 +00:00 committed by Tim Ledbetter
parent a0fb092d94
commit f378f41526
Notes: github-actions[bot] 2024-11-23 21:20:22 +00:00
5 changed files with 986 additions and 1 deletions

View file

@ -153,7 +153,7 @@ Attr const* NamedNodeMap::get_attribute(FlyString const& qualified_name, size_t*
// 2. Return the first attribute in elements attribute list whose qualified name is qualifiedName; otherwise null.
for (auto const& attribute : m_attributes) {
if (compare_as_lowercase) {
if (attribute->name().equals_ignoring_ascii_case(qualified_name))
if (attribute->name().equals_ignoring_ascii_case(qualified_name) && !AK::any_of(attribute->name().bytes(), is_ascii_upper_alpha))
return attribute;
} else {
if (attribute->name() == qualified_name)