Detailing Code

Though using basic shape elements can help you and other developers more easily discern the rendering function of an element, such elements can't always provide you with the information you need to understand the visual function of the element.

Using id attributes can certainly assist in this problem. The id attribute not only serves the function as a code identifier, but it also sometimes acts as a nametag for developers. Though naming every element may seem like a tedious task, the alternative (selectively changing each object's style or removing it to see which object was changed) is far more painful.

In the previous example, Listing 20.2, you will note the addition of id attributes on every graphical element. Such nametags ...

Get Sams Teach Yourself SVG in 24 Hours 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.