Comments (5)
I don’t have strong feelings about this one way or another, but I realized I should probably respond at some point so it doesn’t seem like I’m being rude.
Even beyond this, once evergreen browsers snuff out the last remainders of IE and the other engines that occupied the weird middle ground of “tolerates some unescaped URL characters”, mini-svg-data-uri
will probably be unnecessary to the point you could merely replace "
and #
with vanilla JS.
from mini-svg-data-uri.
Since I recently implemented code that records 100s of frames of SVG images to generate a GIF animation from, I double checked what I was using to urlify the SVG data, and it seems to be exactly what you suggested:
frames.push(`data:image/svg+xml;utf8,${encodeURIComponent(svg)}`);
from mini-svg-data-uri.
Modern Browsers do not require escaped < and > in DataURIs
from mini-svg-data-uri.
Modern Browsers do not require escaped < and > in DataURIs
It's for all the other characters that need to be escaped. A custom encoder can make the result more compact, but is of course more complex code. I use a custom encoder in production.
from mini-svg-data-uri.
It's for all the other characters that need to be escaped.
Since I didn't have to support IE anymore (lucky me 8 years now), I have only encoded the # , but maybe there are (URL) characters I haven't used in my SVGs
from mini-svg-data-uri.
Related Issues (14)
- Could we get an online version hosted on GitHub pages? HOT 6
- Incorrect function name referenced in example? HOT 3
- Why single quotes? HOT 3
- Example code not working HOT 2
- Feature request: usable via command line HOT 4
- Should this work in a cursor as well? HOT 3
- Works in link only after pressing Enter HOT 4
- Broken image example HOT 1
- Going the other direction HOT 2
- CLI usage example in README.md incorrect (typo?) HOT 2
- Shorter color names don't check the entire hexcode HOT 11
- Feature request: files -> SASS variables HOT 1
- Not compatible in srcset attribute HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mini-svg-data-uri.