HTMLImageElement -- use of SVG within <canvas>

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:

http://srufaculty.sru.edu/david.dailey/svg/recent/htmlsvgcanvas7b.htm

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

The SVG file in question contains only the following script:

<script><![CDATA[
]]>
</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?

regards,
David

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