From 8b315537e43ff93657b2d23095e2253833b6d2a1 Mon Sep 17 00:00:00 2001 From: TorosFanny Date: Sun, 8 Mar 2020 11:19:39 +0800 Subject: [PATCH] add focus_out event support --- src/lib.rs | 1 + src/webapi/events/focus.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index fde84f75..739f7584 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -437,6 +437,7 @@ pub mod web { pub use webapi::events::focus::{ IFocusEvent, FocusEvent, + FocusOutEvent, BlurEvent }; diff --git a/src/webapi/events/focus.rs b/src/webapi/events/focus.rs index 2ed757f0..c5ccfff3 100644 --- a/src/webapi/events/focus.rs +++ b/src/webapi/events/focus.rs @@ -48,6 +48,20 @@ pub struct FocusEvent( Reference ); impl IEvent for FocusEvent {} impl IFocusEvent for FocusEvent {} +/// The `FocusOutEvent` is fired when an element has been out of focus. The main +/// difference between this event and focusin is that only the latter bubbles. +/// +/// [(JavaScript docs)](https://developer.mozilla.org/en-US/docs/Web/API/Element/focusout_event) +// https://w3c.github.io/uievents/#focusout +#[derive(Clone, Debug, PartialEq, Eq, ReferenceType)] +#[reference(instance_of = "FocusEvent")] +#[reference(event = "focusout")] +#[reference(subclass_of(Event, FocusRelatedEvent))] +pub struct FocusOutEvent( Reference ); + +impl IEvent for FocusOutEvent {} +impl IFocusEvent for FocusOutEvent {} + /// The `BlurEvent` is fired when an element has lost focus. The main difference /// between this event and focusout is that only the latter bubbles. ///