LibWeb: Only make certain <body> and <frameset> events apply to Window

Previously we forwarded all event handler attributes to Window from
these two elements, however, we are only supposed to forward blur,
error, focus, load, resize and scroll.
This commit is contained in:
Luke Wilde 2022-06-27 19:20:09 +01:00 committed by Linus Groh
parent a50a48f6b4
commit ebf2184636
Notes: sideshowbarker 2024-07-17 09:52:38 +09:00
11 changed files with 37 additions and 16 deletions

View file

@ -14,4 +14,15 @@ HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, DOM::Qualified
}
HTMLFrameSetElement::~HTMLFrameSetElement() = default;
DOM::EventTarget& HTMLFrameSetElement::global_event_handlers_to_event_target(FlyString const& event_name)
{
// NOTE: This is a little weird, but IIUC document.body.onload actually refers to window.onload
// NOTE: document.body can return either a HTMLBodyElement or HTMLFrameSetElement, so both these elements must support this mapping.
if (DOM::is_window_reflecting_body_element_event_handler(event_name))
return document().window();
return *this;
}
}