[whatwg] Proposal for <canvas src> to allow images with structured fallback

Tab Atkins Jr. jackalmage at gmail.com
Fri Mar 4 08:51:15 PST 2011


On Thu, Mar 3, 2011 at 6:29 AM, Anne van Kesteren <annevk at opera.com> wrote:
> On Wed, 02 Mar 2011 19:56:54 +0100, Tab Atkins Jr. <jackalmage at gmail.com>
> wrote:
>>
>> Thoughts on the problem or the proposed solution presented here?
>
> Why not use <object>? It already works and avoids overloading <canvas> for
> something it was not designed for.

<object> doesn't expose image APIs like the 'complete' event.  Also,
it takes arbitrary content, not just images, so you can't use it to
contain user-supplied urls.  Finally, <object> has bad interactivity
behavior - if you drop SVG into <object>, the SVG will swallow any
clicks, while SVG-in-<img> doesn't.  Overall it just doesn't have
sufficiently similar behavior to <img> to be used as a drop-in
replacement.

<canvas> doesn't *yet* expose the image APIs, but it wouldn't cause
any conflicts to make it have them.  A canvas without a @src would act
just like an <img> without a @src, which I believe is already
consistent with how <canvas> works.

~TJ



More information about the whatwg mailing list