Skip to content

Change from function api to template api#404

Merged
pearmini merged 11 commits intomainfrom
template-api
Apr 1, 2026
Merged

Change from function api to template api#404
pearmini merged 11 commits intomainfrom
template-api

Conversation

@pearmini
Copy link
Copy Markdown
Member

@pearmini pearmini commented Apr 1, 2026

No description provided.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 1, 2026

Deploying api with  Cloudflare Pages  Cloudflare Pages

Latest commit: a11afa3
Status: ✅  Deploy successful!
Preview URL: https://654707a6.charming-a13.pages.dev
Branch Preview URL: https://template-api.charming-a13.pages.dev

View logs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the DOM construction API from the previous function-based html/svg(tag, options) approach to a template-literal based API (e.g. svg/html as template tags), and updates tests/snapshots accordingly.

Changes:

  • Replaces the old tag(ns)(name, options) builder with a template-tag driven parser/hydrator (src/dom/tag.js), and updates html/svg to parse markup strings.
  • Updates snapshot generators and event tests to use the new template API.
  • Regenerates stored snapshot output files to reflect the new rendering behavior (e.g., <tbody> insertion, wrapper roots).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/dom/tag.js Implements the new template-tag hydration/append logic for attributes, data-driven cloning, and child insertion.
src/dom/svg.js Switches svg to a template tag that parses via innerHTML in an SVG <g> container.
src/dom/html.js Switches html to a template tag that parses via innerHTML in an HTML <div> container.
src/dom/index.js Removes the public re-export of tag from the DOM entrypoint.
test/snapshots.js Rewrites snapshot fixture generators to use the template API.
test/snapshot.spec.js Adds whitespace normalization before snapshot comparison.
test/event.spec.js Updates event tests to use the template API.
test/output/*.html Updates expected snapshot outputs for the new renderer behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pearmini pearmini merged commit d723ba6 into main Apr 1, 2026
2 checks passed
@pearmini pearmini deleted the template-api branch April 1, 2026 22:39
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.

2 participants