Issue 8719: Add basic support for :active selector

This commit is contained in:
Steve Melia 2016-06-17 22:59:05 +01:00
parent 80cb0cf821
commit 421c354d44
5 changed files with 63 additions and 2 deletions

View file

@ -735,9 +735,22 @@ impl Document {
// https://w3c.github.io/uievents/#trusted-events
event.set_trusted(true);
// https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps
let activatable = el.as_maybe_activatable();
match mouse_event_type {
MouseEventType::Click => el.authentic_click_activation(event),
_ => {
MouseEventType::MouseDown => {
if let Some(a) = activatable {
a.enter_formal_activation_state();
}
let target = node.upcast();
event.fire(target);
},
MouseEventType::MouseUp => {
if let Some(a) = activatable {
a.exit_formal_activation_state();
}
let target = node.upcast();
event.fire(target);
},
@ -904,6 +917,7 @@ impl Document {
.inclusive_ancestors()
.filter_map(Root::downcast::<Element>) {
element.set_hover_state(false);
element.set_active_state(false);
}
}