W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2006

[whatwg] toDataURL() and unsupported formats

From: Anne van Kesteren <fora@annevankesteren.nl>
Date: Sun, 21 May 2006 14:24:02 +0200
Message-ID: <20060521142402.b4ob3ci4g9z40ook@webmail.annevankesteren.nl>
Quoting Ian Hickson <ian at hixie.ch>:
>> http://whatwg.org/specs/web-apps/current-work/#todataurl0 defines that
>> for unsupported values UAs must return PNG. How about returning null
>> instead for unsupported types? Where there any reasons to go with
>> something else?
>
> If you want a data: URL, you primarily want a data: URL. The type is
> secondary. Thus getting null is never useful.

If you want data: URL of a specific type, you primarily want a data:  
URL of a specific type. (Otherwise you would just do toDataURL()  
without mentioning the type at all and get a nice PNG back.) Doing  
string checks to see if that succeeded is more error prone than just  
doing `if(c.toDataURL(test))` or a try/catch(e) statement.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
Received on Sunday, 21 May 2006 05:24:02 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:27 UTC