Skip to content

fix(capture): keep svg content in screenshots after an empty <style> (19.3.3) - #186

Merged
TobiasDuelli merged 2 commits into
masterfrom
fix-225583-svg-empty-style
Oct 19, 2026
Merged

TobiasDuelli merged 2 commits into
masterfrom
fix-225583-svg-empty-style

Conversation

@TobiasDuelli

Copy link
Copy Markdown
Collaborator

Problem

Ticket 225583 (Vizzlo): charts are missing from screenshots, and the whole chart area renders blank.

replaceStyleNodes replaced every style sheet without readable rules with <link rel="stylesheet" href={styleSheet.href}>. For an inline <style> with no rules, href is null, which gives <link … href="null">. Inside an <svg>, outerHTML writes that HTML <link> without an end tag. When the renderer re-parses it in svg (foreign content), link is not void, so everything after it in the svg is nested inside it and not painted. This code is unchanged since v6.0.0.

Fix

A sheet without an href (inline) now always takes the existing <style> branch, with its readable rules, or empty when it has none. That is the same "no CSS" result the null link gave, without breaking the svg. Sheets with an href and unreadable rules (cross-origin) still fall back to a <link>. Side effect: the renderer no longer requests <base>/null for empty <style> tags in the head.

Commit 2 is the usual version bump: 19.3.3, CHANGELOG, build/, published/19.3.3/, published/latest/.

Verification

  • New jest test (fails on master); full suite 572/572 green.
  • Real Chromium, bundled ScreenCapture.js, old vs new:
    • The svg keeps all its children (bar 200px wide vs 0).
    • No href="null" anywhere.
    • CSS rules deleted via CSSOM are not revived.
    • A cross-origin <link> stays a <link>.
  • Chromium matrix (old/new SDK × old/new renderer): only old SDK + old renderer is blank.
  • The renderer fix (GleapSDK/Server-HTMLtoImage, branch fix-225583-svg-empty-style) covers captures from older SDKs; this PR also covers svg inside same-origin iframe srcdoc, which the renderer change doesn't reach.
  • 4 independent reviews (parity, consumers, architecture, release risk) + verifier: no blockers.

Release

Merge (deploys the CDN), then git tag 19.3.3 && git push origin 19.3.3 for npm.

🤖 Generated with Claude Code

TobiasDuelli and others added 2 commits October 19, 2026 15:01
An inline style sheet without rules was captured as <link rel="stylesheet" href="null">.
Inside an <svg> that link is serialized without an end tag, so re-parsing the capture
nests every following svg element inside it and the chart renders blank. Sheets without
an href now always become a <style> (empty when they have no rules); sheets with an href
and unreadable rules still fall back to a <link>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TobiasDuelli
TobiasDuelli merged commit 7ac378b into master Oct 19, 2026
1 check passed
@TobiasDuelli
TobiasDuelli deleted the fix-225583-svg-empty-style branch October 19, 2026 13:28
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