Git Product home page Git Product logo

Comments (5)

tigt avatar tigt commented on September 26, 2024 1

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.

killroy42 avatar killroy42 commented on September 26, 2024

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.

Danny-Engelman avatar Danny-Engelman commented on September 26, 2024

Modern Browsers do not require escaped < and > in DataURIs

from mini-svg-data-uri.

killroy42 avatar killroy42 commented on September 26, 2024

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.

Danny-Engelman avatar Danny-Engelman commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.