Skip to content

Commit

Permalink
fix: missing dom root frag polyfill after preact update
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Jul 3, 2024
1 parent 239de3d commit 3d4ed99
Show file tree
Hide file tree
Showing 3 changed files with 1,434 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src/runtime/client/reviver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 change: 0 additions & 1 deletion www/deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"lock": false,
"nodeModulesDir": true,
"tasks": {
"start": "deno run -A --watch=static/,routes/,../src,../docs dev.ts",
Expand Down
Loading

0 comments on commit 3d4ed99

Please sign in to comment.