If the root element has a viewBox attribute with a width or height of zero we currently refuse to render the SVG. In line with the SVG WG's softer failure policy Webkit, Opera and IE all just ignore the broken viewBox attribute. We should do the same for interoperability.
Summary: Ignore viewBox on <svg> is its width or height is not greater than zero → Ignore viewBox on <svg> if its width or height is not greater than zero
Version: unspecified → Trunk
Note that the spec explicitly says: > A negative value for <width> or <height> is an error (see Error processing). > A value of zero disables rendering of the element. http://www.w3.org/TR/SVG11/coords.html#ViewBoxAttribute (Not that that should necessarily stop us -- just pointing out that we do currently match what the spec explicitly calls for.)
(In reply to comment #0) > Webkit, Opera and IE all just ignore the broken viewBox attribute Actually, it's not as simple as I thought. In the case of: http://srufaculty.sru.edu/david.dailey/svg/newstuff/path5.svg they all ignore the broken viewBox attribute, but in the case of my reftest at least Opera and Webkit do not (haven't tested IE). Need to investigate further...
So in the case of this markup: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 0 0"> <rect fill="lime" height="100%" width="100%"/> <rect fill="lime" height="100" width="100"/> </svg> Webkit and Opera both do NOT render the first rect, but DO render the second rect as if there was no viewBox. So whether it seems that they ignore an invalid viewBox or not depends on whether you have percentage or non-percentage lengths in the document. I guess they're resolving percentages against the viewBox rect, but ignoring the viewBox transform since it's singular.
SVG WG's softer failure policy as I understood it was about lists of things displaying up to the point of the first list element being invalid rather than not displaying anything at all. I really think you should take this up on the w3c list and try and get some consensus there on what should happen.
The WG's "softer failure policy" I'm referring to is the attitude change in the WG where we now try to choose more HTML like failure mechanisms across the entire spec. Filed http://www.w3.org/Bugs/Public/show_bug.cgi?id=12540 for the WG to consider.
You need to log in before you can comment on or make changes to this bug.