Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions servo/components/selectors/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3165,7 +3165,7 @@ where

let attribute_flags = parse_attribute_flags(input)?;
let value = value.as_ref().into();
let local_name_lower;
let local_name_lower: Impl::LocalName;
let local_name_is_ascii_lowercase;
let case_sensitivity;
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: tuple assignment (Weak preference, maybe Impl::LocalName to avoid type deduction issues)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but it gets a bit weird because some of the temporaries escape and some don't...

Expand All @@ -3175,8 +3175,12 @@ where
local_name_lower = local_name_lower_cow.as_ref().into();
local_name_is_ascii_lowercase = matches!(local_name_lower_cow, Cow::Borrowed(..));
}
let local_name = local_name.as_ref().into();
if namespace.is_some() || !local_name_is_ascii_lowercase {
let local_name = if local_name_is_ascii_lowercase {
local_name_lower.clone()
} else {
local_name.as_ref().into()
};
Ok(Component::AttributeOther(Box::new(
AttrSelectorWithOptionalNamespace {
namespace,
Expand All @@ -3191,7 +3195,7 @@ where
)))
} else {
Ok(Component::AttributeInNoNamespace {
local_name,
local_name: local_name_lower,
operator,
value,
case_sensitivity,
Expand Down
Loading