Skip to content

Conversation

@nikneym
Copy link
Contributor

@nikneym nikneym commented Dec 3, 2025

This PR ports insertAdjacentHTML and adds insertAdjacentText and insertAdjacentElement APIs to zigdom.

@nikneym nikneym requested a review from karlseguin December 3, 2025 11:01
@nikneym nikneym added the zigdom label Dec 3, 2025

var iter = body.childrenIterator();
while (iter.next()) |child_node| {
_ = try target_node.insertBefore(child_node, prev_node, page);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's probably some optimization opportunity by using page.insertNodeRelative directly. You'd be able to call page.domChanged(); just once (before the loop), and you could skip the call to page.removeNode (which checks mutationobservers), since you know the children are all newly created (would need to manually set their _parent = null before calling). There might be other small tweaks. Not sure if this API is called enough to warrant it though.

@karlseguin karlseguin merged commit 49c0e95 into zigdom Dec 8, 2025
12 of 14 checks passed
@karlseguin karlseguin deleted the nikneym/element-apis branch December 8, 2025 22:52
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants