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,
): HTMLElement & { _frshRootFrag: boolean } {
// @ts-ignore this is fine
return {
const rootFrag = {
_frshRootFrag: true,
nodeType: 1,
parentNode: parent,
@@ -562,6 +562,19 @@ export function createRootFragment(
removeChild(child: Node) {
parent.removeChild(child);
},
// deno-lint-ignore no-explicit-any
} as any;
contains(node: Node | null): boolean {
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,
"tasks": {
"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