mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Trigger the DOMContentLoaded on the Window
This is hacky, but it's inspired by how NetSurf does it. While the Window isn't the parent of the Document, many events should bubble from the Document to the Window. libdom simply doesn't handle this (it has no concept of a Window, and the Document has no parent). We potentially need to do this for multiple event types (NetSurf only does it for the 'load' event as far as I can tell). It would be nice to find a generic way to do this...maybe intercept any addEventListener on the body and registering special events on the Window? For now, `DOMContentLoaded` is the blocking (for finance.yahoo.com) and we can see if this is really an issue for other event types.
This commit is contained in:
@@ -474,6 +474,12 @@ pub const JsRunner = struct {
|
||||
return err;
|
||||
};
|
||||
}
|
||||
|
||||
pub fn dispatchDOMContentLoaded(self: *JsRunner) !void {
|
||||
const HTMLDocument = @import("browser/html/document.zig").HTMLDocument;
|
||||
const html_doc = self.page.window.document;
|
||||
try HTMLDocument.documentIsLoaded(html_doc, self.page);
|
||||
}
|
||||
};
|
||||
|
||||
const RunnerOpts = struct {
|
||||
|
||||
Reference in New Issue
Block a user