Skip to content

fix(export): keep the SVG export readable as XML - #575

Merged
kgoedecke merged 1 commit into
mainfrom
fix/svg-export-xml-safe
Nov 21, 2026
Merged

kgoedecke merged 1 commit into
mainfrom
fix/svg-export-xml-safe

Conversation

@kgoedecke

Copy link
Copy Markdown
Collaborator

Fixes #508.

The browser export serializes the frame with XMLSerializer into a foreignObject. It copies HTML comments and attribute names verbatim, so a frame holding <!-- Hero -- CTA --> or @click / :class / x-on:click (common in agent-written Alpine/Vue markup) produced:

  • an SVG download no XML parser reads (no fallback for SVG)
  • a raster that failed in the browser, so PNG/JPG fell back to the slower server render

dropNonXml in src/lib/frameRaster.ts now removes comments and any un-namespaced attribute whose name isn't an XML NCName (an xml: prefix is kept), template contents included. Neither paints anything, and the bindings are inert once scripts are stripped.

Tests

Two cases in tests/frameRasterBrowser.test.ts: the SVG parses as XML with valid attributes kept, and the PNG renders in the browser. Both fail without the fix.

🤖 Generated with Claude Code

Comments holding `--` and attribute names only HTML allows (`@click`,
`:class`, `x-on:click`) were copied verbatim by the XML serializer, so the
SVG download failed to parse and PNG/JPG fell back to the server render.
Both are dropped before serializing; neither paints anything.

Fixes #508

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Makes SVG exports readable as XML when frames contain HTML-only comments or attribute names.

  • Frame exports remove HTML syntax that XML cannot read.

No actionable issues found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix(export): keep the SVG export readabl..." · Reviewed by Greptile

@kgoedecke
kgoedecke merged commit 5cf5319 into main Nov 21, 2026
10 checks passed
ttalks-dev pushed a commit to ttalks-dev/doop that referenced this pull request Nov 23, 2026
…d picker (doop-design#575)

* feat(components): import from another canvas through a canvas list and picker

"Import from another canvas" used to dump every component of every canvas
into the panel as centred links, imported on one click, with no previews and
no way back. It now swaps the panel for a list of the person's canvases, one
per row with their preview, and a canvas opens a modal to pick components on
previews, the ones already here greyed. Component previews sit in a
fixed-height well so the panel no longer jumps while they load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(components): keep the import picker open mid-import; count only what Import sends

Closing the picker while an import ran let the run's onDone close a picker
opened afterwards. A component that arrived in an earlier, partly failed run
stayed ticked and counted, so Import could be enabled with nothing to send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 40baa44dbcd3d949c44666ebeb5f4b439c226b86)
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.

SVG export produces invalid XML for HTML comments and framework attributes

1 participant