W3C home > Mailing lists > Public > www-svg@w3.org > January 2010

Re: DOM APIs - Accessing The viewBox Attribute

From: Francis Hemsher <fhemsher@gmail.com>
Date: Fri, 22 Jan 2010 09:29:10 -0500
Message-ID: <c41bcc9d1001220629p7934156ve9d186c67eafb6d7@mail.gmail.com>
To: Jeff Schiller <codedread@gmail.com>, www-svg@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT