3 ms·
It's no longer an image, adding JS turned it into an application. It's doubtful it will work outside of the browser, and even in a browser, it will be static w
by rhn_mk1 9y ago
It's no longer an image, adding JS turned it into an application.
It's doubtful it will work outside of the browser, and even in a browser, it will be static when used in an <img> tag.
- grenoire 9y agohttps://shkspr.mobi/svg/calendar.svg https://shkspr.mobi/svg/calendar.svg
- maxerickson 9y agoThat's in the browser but not in an img tag.
- z3t4 9y agoIt works with GNOME image viewer
- jonathanstrange 9y agoSo you could write an application that runs in an SVG that runs inside GNOME image viewer. That's pretty cool.
- TheRealPomax 9y agoIf we're getting stuck on terminology: SVG were never images, so if you called them that, or you thought they were, that was a misconception that can be laid to rest. SVG is a graphics document format, not an image format. It was from the outset designed to allow interaction and programmatic behaviour and its specification explicitly includes sections on how its document model should be exposed to ECMAScript for dynamic document behaviour. As for where this will work: any SVG document viewer that implements the full spec should render this correctly, but you're correct in that it won't execute as document when used as an <img> source in the browser. Not due to anything related to SVG, but simply because that's what the HTML spec says <img> tags should do for any and all content pointe to by the "src" attribute: "The src attribute must be present, and must contain a valid non-empty URL potentially surrounded by spaces referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted." (https://dev.w3.org/html5/spec-preview/the-img-element.html https://dev.w3.org/html5/spec-preview/the-img-element.html)
- Bromskloss 9y ago> must contain a valid non-empty URL potentially surrounded by spaces referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted So it is invalid to point to a scripted SVG, then?
- zaroth 9y agoThey're not saying that what you point to must not have scripting, they're saying that the agent must not page or script whatever it is that you point to. So technically, no it's not "invalid" to point to a scripted SVG, but it better not execute the script. So it might not work the way you want, unless your goal is to see what it looks like without scripting!
- TheRealPomax 9y agoPerfectly valid, but it won't evaluate as a full SVG document, just as the initial document snapshot. Kind of like loading a webpage with scripts disabled, you'll see "something", but that might not actually be what the document was designed to look like at all (so if you're using SVG as <img> source, only static SVG documents will look the way they're supposed to).
- wruza 9y agoShortening the statement, >src must contain an URL referencing a resource that isn’t scripted This says nothing about how agent must treat imgs not following these rules. This entire statement is useless, because the specification should explain what to do with given input, not what input must be. POSIX goes UB route, because it describes what to do to get what you want as a careful programmer. Browser cannot be described like that, because an input is random bytes over network that must be interpreted according to safety rules. But this description is pointless in both senses. It doesn’t specify what must happen on invalid input, nor does it describe the options. Sorry for this rant, but this resembles to me how all other “web” tech is working and described. They just throw a pile of meaningless things together and pretend it’s done, because a reference implementation exists. No surprise there are browser wars and never-ending evolution of the same text-and-images spacerocket tech.