It would be good to see the context of the svg, but the following worked for me with a pure SVG document:
shape = document.getElementsByTagName("svg")[0];
shape.setAttribute("viewBox", "-250 -250 500 750");
Maybe it's because viewBox
is case-sensitive?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…