From 48ab0b384e567dcb87764d0a131d6b63ab56604a Mon Sep 17 00:00:00 2001 From: F4ilji Date: Mon, 6 Jul 2026 18:05:35 +0500 Subject: [PATCH] fix(ssr): add getElementById and other DOM methods to document polyfill --- resources/js/ssr.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/js/ssr.js b/resources/js/ssr.js index 9cca6db..ac8b851 100755 --- a/resources/js/ssr.js +++ b/resources/js/ssr.js @@ -22,7 +22,18 @@ if (typeof globalThis.window === 'undefined') { } if (typeof globalThis.document === 'undefined') { - globalThis.document = { createElement: () => ({ style: {} }), querySelector: () => null, head: { appendChild: () => {} }, body: { appendChild: () => {} } }; + const el = { style: {}, appendChild: () => {}, removeChild: () => {} }; + globalThis.document = { + createElement: () => el, + querySelector: () => null, + querySelectorAll: () => [], + getElementById: () => null, + createTextNode: () => el, + createComment: () => el, + createDocumentFragment: () => el, + head: { appendChild: () => {}, removeChild: () => {} }, + body: { appendChild: () => {}, removeChild: () => {} }, + }; } import '../css/app.css';