fix(ssr): add getElementById and other DOM methods to document polyfill

This commit is contained in:
F4ilji
2026-07-06 18:05:35 +05:00
parent 4c0152ae0f
commit 48ab0b384e
+12 -1
View File
@@ -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';