selectors: Never match ::slotted on <slot>s.

This fixes the test from https://github.com/w3c/web-platform-tests/pull/9212 in
Gecko.
This commit is contained in:
Emilio Cobos Álvarez 2018-01-27 17:42:19 +01:00
parent bc7dd644f6
commit 61e60a87e5
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 36 additions and 7 deletions

View file

@ -419,12 +419,6 @@ pub trait TElement
/// Return whether this element is an element in the HTML namespace.
fn is_html_element(&self) -> bool;
/// Returns whether this element is a <html:slot> element.
fn is_html_slot_element(&self) -> bool {
self.get_local_name() == &*local_name!("slot") &&
self.is_html_element()
}
/// Return the list of slotted nodes of this node.
fn slotted_nodes(&self) -> &[Self::ConcreteNode] {
&[]

View file

@ -2205,6 +2205,12 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
self.as_node().owner_doc().is_html_document()
}
#[inline]
fn is_html_slot_element(&self) -> bool {
self.is_html_element() &&
self.get_local_name().as_ptr() == local_name!("slot").as_ptr()
}
#[inline]
fn ignores_nth_child_selectors(&self) -> bool {
self.is_root_of_anonymous_subtree()

View file

@ -295,6 +295,10 @@ impl<'a, E> Element for ElementWrapper<'a, E>
self.element.is_html_element_in_html_document()
}
fn is_html_slot_element(&self) -> bool {
self.element.is_html_slot_element()
}
fn get_local_name(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedLocalName {
self.element.get_local_name()
}