[svgwg] How to treat absence of viewBox (#896)

longsonr has just created a new issue for https://github.com/w3c/svgwg:

== How to treat absence of viewBox ==
- [The viewBox attribute for SVG 2 is defined here](https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute).
-  In SVG 1.2 Tiny it [was defined here](https://www.w3.org/TR/SVGTiny12/coords.html#ViewBoxAttribute) and supported an additional value of none

The none value allows some additional use cases...

1. You could use it in a [fragment identifier](https://www.w3.org/TR/SVG/linking.html#SVGFragmentIdentifiers)

#svgView(viewBox(none))

to get rid of a viewBox on some external content that had one if you didn't want it.

2. You could SMIL animate away a viewBox, because SMIL can't remove an attribute. Having values="0 0 100 100;none" is possible if there's a none attribute though.

So

1. Should we retain/reintroduce the none value into SVG 2
2. What should the baseVal and animVal of content that does not have a viewBox be?

let svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");

what is svgElement.viewBox.baseVal?

Should it be an SVGRect or null? If it's an SVGRect is it x=0 y=0 width=0 height=0? If so that doesn't distinguish it from content that has a viewBox with that value, and such content shouldn't display should it as it has an invalid viewBox.

In Firefox svgElement.viewBox.baseVal is null, in Chrome/Safari it's an SVGRect

If we allow viewBox="none" then what is svgElement.viewBox.baseVal and is there any way to tell there is a viewBox. svgElement.hasAttribute("viewBox") will tell you if there's an attribute but it won't tell you if the viewBox exists because of SMIL.






Please view or discuss this issue at https://github.com/w3c/svgwg/issues/896 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 24 October 2022 00:23:10 UTC