3 ms·
An SVG and JS, right? It's not interactive on its own.
by morshu9001 11mo ago
An SVG and JS, right? It's not interactive on its own.
- avsm 11mo agoThe JS is embedded within the SVG file and not exposed outside it
- strickinato 11mo agoSort of... the SVG is referencing `svgscript.js` which is being fetched from the server (https://jon.recoil.org/blog/2025/12/svgscript.js https://jon.recoil.org/blog/2025/12/svgscript.js)
- zamadatix 11mo agoThe JS is exposed in the full page's context the same as if you included a <script> under a <div> instead of <svg>. In much the same way, whether the <script> is before or after the <svg> tag doesn't matter - it's just a script working on a single DOM (with different namespaces for certain elements) either way.
- morshu9001 11mo agoI guess the point is you can give a single .svg file with the js inside. But you can also give a single .html with svg and js inside.
- deleted 11mo ago[deleted]