Default size and autodetection (SVG 2?)

Hi,

If I load SVG into <img> and top <svg> tag
doesn't contain width/height, the browser
shows the image as 300x150. Even this
simple box is rendered as 10x10 black square
on an empty 300x150 field:

<svg xmlns="http://www.w3.org/2000/svg">
  <rect width="10" height="10"/>
</svg>

If you load it with <img> tag, there is no way
to query and fix the dimensions of the image.
This is frustrating, because for .jpg and .png
browser is able to get the size automatically.

In <svg> you need to take care that it has
proper width and height attributes, which is
very daunting to do manually. Why browsers
don't autodetect the width/height? They
render .svg much like .jpg or .png anyway.


A side question about SVG2 process.
Are there any efforts to make basic use of
SVG 2 less overburdened with details?
Some people give up even after xmlns tag,
and I think most don't really want to care
about stuff like setting dimensions explicitly.
Are there any guidelines that recommend
following user expectations instead of trying
to create and teach academically right way?

-- 
anatoly t.

Received on Friday, 17 July 2015 08:50:11 UTC