[whatwg] toDataURL() and unsupported formats

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