diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index d9e24f07d9..e873970150 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -985,6 +985,13 @@ bool Document::is_fully_active() const return browsing_context() && browsing_context()->active_document() == this && (browsing_context()->is_top_level() || browsing_context()->container_document()->is_fully_active()); } +// https://html.spec.whatwg.org/multipage/browsers.html#active-document +bool Document::is_active() const +{ + // A browsing context's active document is its active window's associated Document. + return browsing_context() && browsing_context()->active_document() == this; +} + // https://html.spec.whatwg.org/multipage/history.html#dom-document-location Bindings::LocationObject* Document::location() { diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 0b1b4436fc..2c9d044555 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -277,6 +277,7 @@ public: bool has_a_style_sheet_that_is_blocking_scripts() const; bool is_fully_active() const; + bool is_active() const; NonnullRefPtr history() const { return m_history; }