Skip to content

Add data URL support for data:image/svg+xml URLs#1562

Merged
tanem merged 2 commits into
masterfrom
dataurl
Feb 17, 2026
Merged

Add data URL support for data:image/svg+xml URLs#1562
tanem merged 2 commits into
masterfrom
dataurl

Conversation

@tanem

@tanem tanem commented Feb 17, 2026

Copy link
Copy Markdown
Owner

Parse SVG content directly from data URLs without making XHR requests. This avoids Content Security Policy violations when bundlers like Vite inline small SVGs as data URIs.

Supported formats: URL-encoded (,), base64 (;base64,), and charset (;charset=utf-8,). Fragment identifiers work for sprite extraction. DOMParser is used for parsing with parsererror detection.

Inspired by @nathan-knight’s idea in #1467, reworked for the current codebase 🙏

Parse SVG content directly from data URLs without making XHR requests. This avoids Content Security Policy violations when bundlers like Vite inline small SVGs as data URIs.

Supported formats: URL-encoded (,), base64 (;base64,), and charset (;charset=utf-8,). Fragment identifiers work for sprite extraction. DOMParser is used for parsing with parsererror detection.
@tanem tanem merged commit dacb560 into master Feb 17, 2026
2 checks passed
@tanem tanem deleted the dataurl branch February 17, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant