Scripting SVG

You have seen how SVG declarative animation can produce visual effects that would require JavaScript if you tried to create the effects using HTML. But JavaScript is still important for use with SVG—for example, when you want to include decision logic about when particular actions are to be carried out. In this section, you will be introduced to some basic JavaScript techniques that you can use with SVG.

The Document Object Model

The W3C Document Object Model, often simply called the DOM, is a specification that describes HTML and XML documents as hierarchies of objects. The DOM is essentially an Application Programming Interface (API) to the elements in an HTML or XML document. JavaScript is one of the scripting languages that ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.