Open
Bug 651696
Opened 14 years ago
Updated 3 years ago
Ignore viewBox on <svg> if its width or height is not greater than zero
Categories
(Core :: SVG, defect)
Core
SVG
Tracking
()
NEW
People
(Reporter: jwatt, Unassigned)
Details
Attachments
(1 file)
|
8.61 KB,
patch
|
Details | Diff | Splinter Review |
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.
| Reporter | ||
Updated•14 years ago
|
Assignee: nobody → jwatt
Updated•14 years ago
|
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
| Reporter | ||
Comment 1•14 years ago
|
||
Attachment #527450 -
Flags: review?(longsonr)
Comment 2•14 years ago
|
||
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.)
| Reporter | ||
Updated•14 years ago
|
Attachment #527450 -
Flags: review?(longsonr)
| Reporter | ||
Comment 3•14 years ago
|
||
(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...
| Reporter | ||
Comment 4•14 years ago
|
||
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.
Comment 5•14 years ago
|
||
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.
| Reporter | ||
Comment 6•14 years ago
|
||
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.
| Reporter | ||
Updated•14 years ago
|
Assignee: jwatt → nobody
| Reporter | ||
Updated•14 years ago
|
Assignee: nobody → jwatt
| Reporter | ||
Updated•5 years ago
|
Assignee: jwatt → nobody
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•