Add support for :scope pseudo-class

This commit is contained in:
Xidorn Quan 2017-10-09 17:01:15 +11:00
parent 715fc9cea6
commit ab46a0bbe0
4 changed files with 25 additions and 1 deletions

View file

@ -724,6 +724,12 @@ fn matches_simple_selector<E, F>(
flags_setter(element, HAS_EMPTY_SELECTOR);
element.is_empty()
}
Component::Scope => {
match context.shared.scope_element {
Some(ref scope_element) => element.opaque() == *scope_element,
None => element.is_root(),
}
}
Component::NthChild(a, b) => {
matches_generic_nth_child(element, context, a, b, false, false, flags_setter)
}