3 ms·
> In one case you're dealing if a set of different elements, in another you have the definition of a single shape. Sure, but this is just restating the problem
by jessedhillon 12y ago
> In one case you're dealing if a set of different elements, in another you have the definition of a single shape.
Sure, but this is just restating the problem so that the mental model fits the facts. However you rationalize it, you're forced to deal with the situation that you need your own parsing logic to work with SVGs. That's supposed to be the problem that the choice of XML solves.
Apart from that, the contents of the `d` element are describing individual components -- lines, curves, arcs -- which combine to compose one path. It's not necessarily the case that they need to be treated as one elemental shape, any more than the children of the <g> element are not considered to be indivisibly part of a whole, but rather as individually manipulable components which are organized by the <g> into groups/layers.
Why couldn't <path> be a similar principle of organization?
- aidos 12y agoI guess I come at it from the point of view of the DOM, where a single shape as a DOM node that can be styled makes the most sense. If you had a path with child nodes as real DOM nodes things would get weird, because how do things like contradicting fill styles work? As I said in my other reply though, I'm just splitting hairs really. As a user I think being able to specify the shape by just using the single d attribute is nice. Maybe because it invokes warm childhood memories of using turtle graphics back in the 80s :)