Can I use calc() when setting attributes with setAttribute?
<svg id='svg' xmlns="http://www.w3.org/2000/svg" width="1122" height="800"></svg>
<script>
document.getElementById('svg').setAttribute('height','calc(100vw * 0.5)')
</script>
This is set as a string.
某草草2017-05-19 10:39:19
To set the style, you can pass:
document.getElementById('svg').style.height = 'calc(100vw * 0.5)';