mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Implement the :focus pseudo-class selector
Fixes #5460. This supports for simple focusable elements that are their own DOM anchors, like text `input` fields.
This commit is contained in:
parent
ad6c511a5e
commit
791fa3757d
10 changed files with 106 additions and 9 deletions
|
@ -1461,6 +1461,13 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
|
|||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
node.get_hover_state()
|
||||
}
|
||||
fn get_focus_state(self) -> bool {
|
||||
// TODO: Also check whether the top-level browsing context has the system focus,
|
||||
// and whether this element is a browsing context container.
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#selector-focus
|
||||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
node.get_focus_state()
|
||||
}
|
||||
fn get_id(self) -> Option<Atom> {
|
||||
self.get_attribute(ns!(""), &atom!("id")).map(|attr| {
|
||||
let attr = attr.root();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue