mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibWeb: Make event dispatching spec-compliant
Specification: https://dom.spec.whatwg.org/#concept-event-dispatch This also introduces shadow roots due to it being a requirement of the event dispatcher. However, it does not introduce the full shadow DOM, that can be left for future work. This changes some event dispatches which require certain attributes to be initialised to a value.
This commit is contained in:
parent
819f099a8e
commit
e8b3a65581
Notes:
sideshowbarker
2024-07-19 01:18:46 +09:00
Author: https://github.com/Lubrsi
Commit: e8b3a65581
Pull-request: https://github.com/SerenityOS/serenity/pull/4131
Reviewed-by: https://github.com/awesomekling
32 changed files with 858 additions and 54 deletions
|
@ -180,18 +180,22 @@ void HTMLDocumentParser::run(const URL& url)
|
|||
script.execute_script();
|
||||
}
|
||||
|
||||
m_document->dispatch_event(DOM::Event::create("DOMContentLoaded"));
|
||||
|
||||
// FIXME: These are not in the right place, they should only fire once subresources are ready.
|
||||
m_document->dispatch_event(DOM::Event::create("load"));
|
||||
m_document->window().dispatch_event(DOM::Event::create("load"));
|
||||
auto content_loaded_event = DOM::Event::create("DOMContentLoaded");
|
||||
content_loaded_event->set_bubbles(true);
|
||||
m_document->dispatch_event(content_loaded_event);
|
||||
|
||||
auto scripts_to_execute_as_soon_as_possible = m_document->take_scripts_to_execute_as_soon_as_possible({});
|
||||
for (auto& script : scripts_to_execute_as_soon_as_possible) {
|
||||
script.execute_script();
|
||||
}
|
||||
|
||||
// FIXME: Spin the event loop until there is nothing that delays the load event in the Document.
|
||||
|
||||
m_document->set_ready_state("complete");
|
||||
m_document->window().dispatch_event(DOM::Event::create("load"));
|
||||
|
||||
m_document->set_ready_for_post_load_tasks(true);
|
||||
m_document->completely_finish_loading();
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue