preact icon indicating copy to clipboard operation
preact copied to clipboard

Ownerdocument rebased

Open alshdavid opened this issue 1 year ago • 6 comments

alshdavid avatar Sep 16 '24 04:09 alshdavid

Looks like the tests are currently failing when passing in document as a render-target. This is a valid use-case to render a full HTML tree and that indeed has null for the ownerDocument so we'd have to take a null'ish ownerDocument into account and default to document I reckon.

JoviDeCroock avatar Sep 16 '24 10:09 JoviDeCroock

It looks like some of the tests regarding types are not passing, would the following changes help?

diff --git a/test/ts/preact.tsx b/test/ts/preact.tsx
index 3713f9d8..e6d81eb3 100644
--- a/test/ts/preact.tsx
+++ b/test/ts/preact.tsx
@@ -102,7 +102,8 @@ function createRootFragment(parent: Element, replaceNode: Element | Element[]) {
                appendChild: (c: Node) => insert(c, null),
                removeChild: function (c: Node) {
                        return parent.removeChild(c);
-               }
+               },
+               ownerDocument: parent.ownerDocument,
        });
 }

hzy avatar Sep 27 '24 06:09 hzy

CC @marvinhagemeister how should we best handle the undefined case you think, might be relevant for fresh?

JoviDeCroock avatar Oct 01 '24 09:10 JoviDeCroock

📊 Tachometer Benchmark Results

Summary

A summary of the benchmark results will show here once they finish.

Results

The full results of your benchmarks will show here once they finish.

tachometer-reporter-action v2 for CI

github-actions[bot] avatar Feb 19 '25 02:02 github-actions[bot]

I have squashed the changes and added @Hydrophobefireman as a co-author. Should make it easier to rebase in future. There are some issues (even with main). I am unable to run npm run test:mocha locally, not sure what additional configuration I need to do to get that working

alshdavid avatar Feb 19 '25 02:02 alshdavid

I am unable to run npm run test:mocha locally

You probably need to add "type": "commonjs" to the pkg.json, I'm guessing you're on Node v22+. We tried to add that but it broke some of people's setups. Seems that Node has changed how require hooks work.

rschristian avatar Feb 19 '25 03:02 rschristian

Implemented in https://github.com/preactjs/preact/pull/4851

JoviDeCroock avatar Jul 26 '25 09:07 JoviDeCroock