Add :any-link (Level 4), :link and :visited selectors.

All links are considered "unvisited" for now.
This commit is contained in:
Simon Sapin 2013-11-07 15:05:15 +00:00
parent 651b2f072b
commit 74dfc3b66a
4 changed files with 50 additions and 2 deletions

View file

@ -130,6 +130,18 @@ impl ElementLike for Element {
return value;
}
fn get_link<'a>(&'a self) -> Option<&'a str> {
// FIXME: This is HTML only.
match self.node.type_id {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#selector-link
ElementNodeTypeId(HTMLAnchorElementTypeId) |
ElementNodeTypeId(HTMLAreaElementTypeId) |
ElementNodeTypeId(HTMLLinkElementTypeId)
=> self.get_attr("href"),
_ => None,
}
}
}
impl<'self> Element {