Skip to content

Fix regression in SVGs with only one of width/height missing

Consider this:

  <svg xmlns="http://www.w3.org/2000/svg" width="60" viewBox="0 0 30 40">

The height should default to 100%. If this were being rendered to a viewport, then no problem - use 60 units for the width, and the viewport's entire height.

But we are being asked to produce a "natural size", and we don't have a viewport size. So, just produce a size based on the width and the viewBox's aspect ratio.

Fixes #797 (closed)

Edited by Federico Mena Quintero

Merge request reports