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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants