mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Match attribute selectors case insensitively in XML documents
The values of attribute selectors are now compared case insensitively by default if the attribute's document is not a HTML document, or the element is not in the HTML namespace.
This commit is contained in:
parent
c422518792
commit
00f03f3e90
Notes:
github-actions[bot]
2024-08-19 07:04:16 +00:00
Author: https://github.com/tcl3
Commit: 00f03f3e90
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1116
5 changed files with 54 additions and 62 deletions
|
@ -260,15 +260,8 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_attribute_simple_se
|
|||
.type = Selector::SimpleSelector::Type::Attribute,
|
||||
.value = Selector::SimpleSelector::Attribute {
|
||||
.match_type = Selector::SimpleSelector::Attribute::MatchType::HasAttribute,
|
||||
// FIXME: Case-sensitivity is defined by the document language.
|
||||
// HTML is insensitive with attribute names, and our code generally assumes
|
||||
// they are converted to lowercase, so we do that here too. If we want to be
|
||||
// correct with XML later, we'll need to keep the original case and then do
|
||||
// a case-insensitive compare later.
|
||||
.qualified_name = qualified_name,
|
||||
.case_type = case_insensitive_html_attributes.contains_slow(qualified_name.name.lowercase_name)
|
||||
? Selector::SimpleSelector::Attribute::CaseType::CaseInsensitiveMatch
|
||||
: Selector::SimpleSelector::Attribute::CaseType::DefaultMatch,
|
||||
.case_type = Selector::SimpleSelector::Attribute::CaseType::DefaultMatch,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue