mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-30 08:18:49 +00:00
LibWeb: Ignore window-forwarded document.body.onfoo in detached DOM
Normally, assigning to e.g document.body.onload will forward to window.onload. However, in a detached DOM tree, there is no associated window, so we have nowhere to forward to, making this a no-op. The bulk of this change is making Document::window() return a nullable pointer, as documents created by DOMParser or DOMImplementation do not have an associated window object, and so must be able to return null from here.
This commit is contained in:
parent
7139d5945f
commit
b98a2be96b
Notes:
sideshowbarker
2024-07-19 01:59:31 +09:00
Author: https://github.com/awesomekling
Commit: b98a2be96b
Pull-request: https://github.com/SerenityOS/serenity/pull/23549
28 changed files with 92 additions and 61 deletions
|
@ -941,7 +941,7 @@ static void update_the_source_set(DOM::Element& element)
|
|||
if (child->has_attribute(HTML::AttributeNames::media)) {
|
||||
auto media_query = parse_media_query(CSS::Parser::ParsingContext { element.document() },
|
||||
child->get_attribute_value(HTML::AttributeNames::media));
|
||||
if (!media_query || !media_query->evaluate(element.document().window())) {
|
||||
if (!media_query || !element.document().window() || !media_query->evaluate(*element.document().window())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue