Make some selector matching code a little more consistent.

This commit is contained in:
Ms2ger 2014-02-16 10:25:30 +01:00
parent 6681476713
commit f556197567

View file

@ -622,7 +622,9 @@ fn matches_simple_selector<E:TElement,
// here because the UA style otherwise disables all style sharing completely. // here because the UA style otherwise disables all style sharing completely.
*shareable = false *shareable = false
} }
element.match_attr(attr, |v| v == value.as_slice()) element.match_attr(attr, |attr_value| {
attr_value == value.as_slice()
})
} }
AttrIncludes(ref attr, ref value) => { AttrIncludes(ref attr, ref value) => {
*shareable = false; *shareable = false;
@ -633,7 +635,8 @@ fn matches_simple_selector<E:TElement,
AttrDashMatch(ref attr, ref value, ref dashing_value) => { AttrDashMatch(ref attr, ref value, ref dashing_value) => {
*shareable = false; *shareable = false;
element.match_attr(attr, |attr_value| { element.match_attr(attr, |attr_value| {
attr_value == value.as_slice() || attr_value.starts_with(dashing_value.as_slice()) attr_value == value.as_slice() ||
attr_value.starts_with(dashing_value.as_slice())
}) })
} }
AttrPrefixMatch(ref attr, ref value) => { AttrPrefixMatch(ref attr, ref value) => {