Skip to content

Conversation

@botandrose
Copy link
Collaborator

@botandrose botandrose commented Mar 3, 2025

The main difference here is that childNodes is now a live calculation, based on a bounding box defined by the originally-passed node's siblings. In other words, a parent node containing a live slice of its children.

Also, the SlicedParentNode name is better and more intention-revealing, I think.

Lastly, it is now a JavaScript class, which definitely goes against the overall C-ish style of Idiomorph. But since we're emulating a concrete aspect of the OOP DOM API, I think it makes sense.

Fixes #124, and the return value issue in #126.

@botandrose
Copy link
Collaborator Author

npm run perf v0.7.2 shows no detectable perf difference from v0.7.2 on any benchmark, which is what I think we should expect.

Its slower to recalculate the childNodes each call, as opposed to returning a static array, of course. But that recalculation should only happen a few times per morph when we're morphing outerHTML style, and thus be negligible.

All benchmarks ARE using the outerHTML morph style, though, so this code is definitely getting run!

@botandrose botandrose force-pushed the sliced-parent-node branch from db3753d to e546299 Compare March 5, 2025 22:54
@botandrose botandrose merged commit 8be8b46 into main Mar 5, 2025
12 checks passed
@botandrose botandrose deleted the sliced-parent-node branch March 5, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hx-* attributes ignored when swapping in different type of element

4 participants