svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.04k stars 1.08k forks source link

Missing width or height in foreignObject is taken as zero and not as missing #1140

Closed crystalfp closed 4 years ago

crystalfp commented 4 years ago

Bug report

If in a call to foreignObject() I leave undefined the height parameter, the resulting svg object has height="0". Instead I expect height attribute to be missing.

Explanation

If height is not present, the foreignObject is taking it from the object inside.

Thanks for considering! mario

Fuzzyma commented 4 years ago

You are not supposed to leave the height out. If you do so, you have to expect unwanted behavior. However in this case the behavior is completely fine. If you need to remove the height attr you can follow up with el.attr('height', null)