fix: missing dom root frag polyfill after preact update (#2569)

This commit is contained in:
Marvin Hagemeister
2024-07-03 10:39:33 +02:00
committed by GitHub
parent 239de3d08a
commit 6be6435467
3 changed files with 1434 additions and 4 deletions
+16 -3
View File
@@ -528,7 +528,7 @@ export function createRootFragment(
endMarker: Text | Comment, endMarker: Text | Comment,
): HTMLElement & { _frshRootFrag: boolean } { ): HTMLElement & { _frshRootFrag: boolean } {
// @ts-ignore this is fine // @ts-ignore this is fine
return { const rootFrag = {
_frshRootFrag: true, _frshRootFrag: true,
nodeType: 1, nodeType: 1,
parentNode: parent, parentNode: parent,
@@ -562,6 +562,19 @@ export function createRootFragment(
removeChild(child: Node) { removeChild(child: Node) {
parent.removeChild(child); parent.removeChild(child);
}, },
// deno-lint-ignore no-explicit-any contains(node: Node | null): boolean {
} as any; if (node === null) return false;
const children = rootFrag.childNodes;
for (let i = 0; i < children.length; i++) {
if (children[i].contains(node)) {
return true;
}
}
return false;
},
};
// deno-lint-ignore no-explicit-any
return rootFrag as any;
} }
-1
View File
@@ -1,5 +1,4 @@
{ {
"lock": false,
"nodeModulesDir": true, "nodeModulesDir": true,
"tasks": { "tasks": {
"start": "deno run -A --watch=static/,routes/,../src,../docs dev.ts", "start": "deno run -A --watch=static/,routes/,../src,../docs dev.ts",
Generated
+1418
View File
File diff suppressed because it is too large Load Diff