Implement cannot navigate

This commit is contained in:
CYBAI 2019-01-10 18:58:07 +08:00
parent 9d70f51356
commit cb86d451e6
4 changed files with 26 additions and 12 deletions

View file

@ -3235,6 +3235,18 @@ impl Element {
let root = node.GetRootNode();
root.is::<Document>()
}
// https://html.spec.whatwg.org/multipage/#cannot-navigate
pub fn cannot_navigate(&self) -> bool {
let document = document_from_node(self);
// Step 1.
!document.is_fully_active() ||
(
// Step 2.
!self.is::<HTMLAnchorElement>() && !self.is_connected()
)
}
}
impl Element {