Fix turbo nav layout flash and stats page not loading.
Wait for page CSS before swapping content, hoist inline styles to head, and boot page scripts immediately when DOM markers exist. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,4 +14,14 @@
|
||||
global.qihuoEmitPageLoad = function () {
|
||||
global.dispatchEvent(new Event('qihuo:page-load'));
|
||||
};
|
||||
|
||||
/** Register page boot + run now if the page marker is already in DOM (turbo nav). */
|
||||
global.qihuoPageBoot = function (fn, selector) {
|
||||
function run() {
|
||||
if (selector && !global.document.querySelector(selector)) return;
|
||||
fn();
|
||||
}
|
||||
global.addEventListener('qihuo:page-load', run);
|
||||
run();
|
||||
};
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user