3 ms·
I'm kind of confused by the title. This shouldn't be a surprise/news as SVG explicitly uses JavaScript as its scripting language. That's why there's an SVG DOM.
by cbsmith 3y ago
I'm kind of confused by the title. This shouldn't be a surprise/news as SVG explicitly uses JavaScript as its scripting language. That's why there's an SVG DOM. Yes you can do animations with SMIL, but JavaScript is explicitly there for more complex interactions.
https://www.w3.org/TR/SVG11/script.html https://www.w3.org/TR/SVG11/script.html
- yencabulator 3y agoThere's a huge difference between an HTML page being able to animate contained SVG, and SVG being allowed to contain Javascript in itself. There's a huge difference between Javascript-in-SVG being allowed to manipulate the SVG itself, versus being interpreted as part of the HTML page.
- cbsmith 3y agoI don't disagree with these statements, but I don't understand how they're relevant to my point. The Javascript-in-SVG is what I pointed to in the spec. 18.2: "A ‘script’ element is equivalent to the ‘script’ element in HTML and thus is the place for scripts (e.g., ECMAScript). Any functions defined within any ‘script’ element have a "global" scope across the entire current document."