Re: DOM APIs - Accessing The viewBox Attribute

On 1/22/10, Jeff Schiller <codedread@gmail.com> wrote:
> Hi Francis,
>
> It is already possible to get the viewBox attributes (though it's very
> verbose due to animation possibilities).  See the SVGFitToViewBox
> interface in the DOM IDL: http://www.w3.org/TR/SVG11/idl.html from
> which the <svg>, <symbol>, and <marker> elements all inherit:
>
> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300">
> <script>
>   var svgroot = document.documentElement;
>   var vb = svgroot.viewBox.baseVal;
>   alert([vb.x, vb.y, vb.width, vb.height]);
> </script>
> </svg>
>
> Works in Firefox, Opera, Safari and Chrome.
>
> Regards,
> Jeff
>

Thanks, Jeff,
Yep, it doesn't work in IE/ASV. It seems, not only verbose;), but also
obtuse to the web developer. So, I'm going stick with my request to
include this.

Nice to hear from you,
Francis

Received on Friday, 22 January 2010 14:29:42 UTC