diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 3fbe3f1ba86..feea781db74 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -5676,4 +5676,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 a81fb8d70fe..dc4466681ee 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -734,6 +734,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 {