W3C home > Mailing lists > Public > public-html@w3.org > April 2011

HTMLImageElement -- use of SVG within <canvas>

From: Dailey, David P. <david.dailey@sru.edu>
Date: Thu, 28 Apr 2011 19:53:32 -0400
To: "public-html@w3.org" <public-html@w3.org>
Message-ID: <C64F09DF6833C44782B27844765560BC1781E96158@MSFEXCH01.srunet.sruad.edu>
The drawImage method of <canvas> should be able to take an HTMLImageElement as its image argument.

An HTMLImageElement should include

"Images can thus be static bitmaps (e.g. PNGs, GIFs, JPEGs), single-page vector documents (single-page PDFs, XML files with an SVG root element), animated bitmaps (APNGs, animated GIFs), animated vector graphics (XML files with an SVG root element that use declarative SMIL animation), and so forth. However, this also precludes SVG files with script, multipage PDF files, interactive MNG files, HTML documents, plain text documents, and so forth."

I assume there are good reasons for excluding SVG files with script; at least I am certain that careful thought went into that stipulation, and will assume the thinking was cogent.

However, it would be nicer, I think, to allow one to reference an SVG file that happens to have script, and to render the image, but simply not to require the script to be run.

See for example:


It runs "properly" in no extant browser, that I'm aware of.

The SVG file in question contains only the following script:


which is sort of a generic boilerplate oftentimes included in SVG files, should they need, later on to be scripted.

On the other hand, the above file, when referencing a JPEG rather than an SVG runs "properly" in all modern browsers I've tested. (IE9, Chrome, FF4, Opera, and Safari): http://srufaculty.sru.edu/david.dailey/svg/recent/htmlsvgcanvas7a.htm

Instead of "precluding" SVG with script, could we instead include "XML files with an SVG root element" (as is already stated) and simply add that browsers are not required to support (or even are precluded from running if that makes sense for security reasons) scripting associated with the SVG DOM of such images?

Received on Thursday, 28 April 2011 23:54:01 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:37 UTC