[svgwg] Not able to get width/height before calling getClientRects() (#801)

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

== Not able to get width/height before calling getClientRects() ==
```
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
</svg>
```

Specifying the width/height of svg node in % makes them inaccessible through `svg.width/height.baseVal.value`, [even tho using % is allowed](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/width), not sure why this is so?

Wrapping `svg.width/height.baseVal.value` in `window.onload` does not change anything. Only able to access width/height when `svg.getClientRects()` is invoked beforehand.

```
// svg is the svg DOM node
svg.getClientRects(); // Must be called
const svgWidth = svg.width.baseVal.value;
const svgHeight = svg.height.baseVal.value;
```

P.S. (In Chrome)
```
console.log(svg.width.baseVal); // Preview shows 0, when expanded shows the actual width
console.log(svg.height.baseVal.value); // Shows 0
```


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

Received on Sunday, 28 June 2020 05:29:32 UTC