mirror of
https://github.com/servo/servo.git
synced 2025-10-15 16:00:28 +01:00
9 lines
No EOL
445 B
JavaScript
9 lines
No EOL
445 B
JavaScript
function open_and_add_load_event(href, func) {
|
|
// While not practically possible, opening "blank" first and setting the
|
|
// href after allows for the theoretical possibility of registering the event
|
|
// after the window is loaded.
|
|
let popup_window = window.open("about:blank");
|
|
assert_not_equals(popup_window, null, "Popup windows not allowed?");
|
|
popup_window.addEventListener('load', func, false);
|
|
popup_window.location.href=href;
|
|
} |