diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index a8aafce6621..6b3f91cf3b0 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -5637,4 +5637,14 @@ void Document::set_onreadystatechange(WebIDL::CallbackType* value) set_event_handler_attribute(HTML::EventNames::readystatechange, value); } +WebIDL::CallbackType* Document::onvisibilitychange() +{ + return event_handler_attribute(HTML::EventNames::visibilitychange); +} + +void Document::set_onvisibilitychange(WebIDL::CallbackType* value) +{ + set_event_handler_attribute(HTML::EventNames::visibilitychange, value); +} + } diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index f561e1ac7e6..cdf367da66c 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -722,6 +722,9 @@ public: [[nodiscard]] WebIDL::CallbackType* onreadystatechange(); void set_onreadystatechange(WebIDL::CallbackType*); + [[nodiscard]] WebIDL::CallbackType* onvisibilitychange(); + void set_onvisibilitychange(WebIDL::CallbackType*); + protected: virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl index 19fb2a7b7d5..10b5b1dc545 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.idl +++ b/Userland/Libraries/LibWeb/DOM/Document.idl @@ -152,7 +152,7 @@ interface Document : Node { // special event handler IDL attributes that only apply to Document objects [LegacyLenientThis] attribute EventHandler onreadystatechange; - [FIXME] attribute EventHandler onvisibilitychange; + attribute EventHandler onvisibilitychange; }; dictionary ElementCreationOptions {