1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:57:44 +00:00

LibWeb: Expose the GlobalEventHandlers mixin on the Window object

We now expose all the `onfoo` event handler attributes on the window
object. This makes `window.onload = ...` actually work. :^)
This commit is contained in:
Andreas Kling 2021-09-22 16:39:15 +02:00
parent fb2f7c7b9c
commit 635ab6db0b
3 changed files with 54 additions and 1 deletions

View file

@ -16,6 +16,7 @@
#include <LibWeb/CSS/Screen.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
namespace Web::DOM {
@ -23,7 +24,8 @@ class RequestAnimationFrameCallback;
class Window final
: public RefCounted<Window>
, public EventTarget {
, public EventTarget
, public HTML::GlobalEventHandlers {
public:
static NonnullRefPtr<Window> create_with_document(Document&);
~Window();
@ -81,6 +83,9 @@ public:
private:
explicit Window(Document&);
// ^HTML::GlobalEventHandlers
virtual DOM::EventTarget& global_event_handlers_to_event_target() override { return *this; }
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
WeakPtr<Document> m_associated_document;