Update 2013-10: Confirmed fixed in v24 which now made it into the release channel
Update 2013-07: Bug is solved! Fix will make it into Firefox 24 which will be released somewhere between September and October
I read about a somewhat simple solution to this problem somewhere that I now use in my projects (will add source when i find it again):
simply set width and height of the svg-container to the maximum values the image is likely going to have and you are fine. Works in all current browsers just fine. only restriction is, that firefox and opera (yes, the same two browsers that caused this mess) dont work well with very big images --> dont use too high values for the dimensions
original file:
<svg width="64px" height="128px">
lets say the maxium width will be 3x that big, then your SVG should contain this:
<svg width="192px" height="384px">
(yes, the svg
node can have more attributes...)
The reason why this works is that Opera and FF render SVGs before resizing them instead of the other way round as it is supposed to be done with vector gfx
UPDATE: credits go to David Bushell who wrote a wonderfull article on Resolution Independence With SVG.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…