mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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
|
@ -454,7 +454,20 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
/// transaction, or none if no elements requested it.
|
||||
fn commit_focus_transaction(self) {
|
||||
//TODO: dispatch blur, focus, focusout, and focusin events
|
||||
|
||||
if let Some(ref elem) = self.focused.get().root() {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(elem.r());
|
||||
node.set_focus_state(false);
|
||||
}
|
||||
|
||||
self.focused.assign(self.possibly_focused.get());
|
||||
|
||||
if let Some(ref elem) = self.focused.get().root() {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(elem.r());
|
||||
node.set_focus_state(true);
|
||||
}
|
||||
// TODO: Update the focus state for all elements in the focus chain.
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#focus-chain
|
||||
}
|
||||
|
||||
/// Handles any updates when the document's title has changed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue