Don’t visit attribute selectors that never match.

This commit is contained in:
Simon Sapin 2017-05-18 13:31:04 +02:00
parent c06e574c18
commit c968842653

View file

@ -316,7 +316,6 @@ impl<Impl: SelectorImpl> SelectorMethods for Component<Impl> {
}
}
AttributeInNoNamespace { ref local_name, ref local_name_lower, .. } |
AttributeInNoNamespaceExists { ref local_name, ref local_name_lower } => {
if !visitor.visit_attribute_selector(
&NamespaceConstraint::Specific(&namespace_empty_string::<Impl>()),
@ -326,7 +325,17 @@ impl<Impl: SelectorImpl> SelectorMethods for Component<Impl> {
return false;
}
}
AttributeOther(ref attr_selector) => {
AttributeInNoNamespace { ref local_name, ref local_name_lower, never_matches, .. }
if !never_matches => {
if !visitor.visit_attribute_selector(
&NamespaceConstraint::Specific(&namespace_empty_string::<Impl>()),
local_name,
local_name_lower,
) {
return false;
}
}
AttributeOther(ref attr_selector) if !attr_selector.never_matches => {
if !visitor.visit_attribute_selector(
&attr_selector.namespace(),
&attr_selector.local_name,