Me and SVG
So here&#x27;s a question:<p>JSON is to XML what ___ is to SVG. What is in the blank?<p>There&#x27;s just so much complexity in even the 1.1 spec.<p>Patterns, for example, are given the default of specifying the width and height of the area to be repeated in objectBoundingBox units. But the arbitrarily complex content has its units defined in terms of the userspace units derived from the context in which the pattern itself is used.<p>Now, if you play around with patterns for a bit you can certainly figure out the logic of those defaults. Most likely the author doesn&#x27;t want the aspect ratio of the pattern <i>content</i> to change based on the width&#x2F;height specified for the pattern viewbox. Hence patternContentUnits defaults to &quot;userSpaceOnUse&quot;. On the other hand, the author likely wants to control the total number of columns&#x2F;rows that will be displayed. Hence patternUnits defaults to &quot;objectBoundingBox&quot;, where you can do the math for 1&#x2F;width for rows and 1&#x2F;height for columns.<p>But then when you try to do actual work using those defaults-- say, filling a rectangle with a pattern that displays four small circles as &quot;nails&quot; in the corners of the rectangle-- it doesn&#x27;t work. The patternUnits attribute isn&#x27;t expressive enough to let you specify a way to attach each pattern iteration to a corner of the shape. You <i>can</i> achieve that for a particular bounding box, but it isn&#x27;t easy. So the logical though complex default isn&#x27;t particularly expressive in practice, and the more sane, less expressive way to do patterns requires non-default attributes.<p>I run into similar such problems with many of the SVG 1.1 features. There&#x27;s an incredible amount of complexity, but not a matching amount of expressivity gained for it. Even something like grabbing or setting a value for height&#x2F;width&#x2F;x&#x2F;y is made more complex because the DOM is storing both a base value and an additional value should the user happen to have specified declarative animation on the element. But then declarative animation isn&#x27;t implemented in all browsers after all this time-- nor is it as easy to work with as the burgeoning web animations API.