[whatwg] Stream API Feedback

Lachlan Hunt lachlan.hunt at lachy.id.au
Thu Mar 17 10:41:56 PDT 2011


On 2011-03-17 16:48, Olli Pettay wrote:
>> ... src property definition needs to be changed
>> from DOMString to any.
>
> That would be strange and make API inconsistent with <img> and <iframe>
> for example.

This is getting a bit off topic, but it would be better if they were 
also modified so that authors could, instead of doing this:

var file = document.getElementById('file').files[0];
if(file){
   blobURLref = window.URL.createObjectURL(file);
   myimg.src = blobURLref;
}

(Example from File API spec [1])

Do this:

var file = document.getElementById('file').files[0];
if (file) img.src = file;

The creation of a URL is just an unnecessary step for an issue that can 
be handled internally by the browser, and suffers from the problems that 
Philip pointed out.  Besides, this was all discussed in the WebApps WG 
some time ago [2].

[1] http://dev.w3.org/2006/webapi/FileAPI/#dfn-createObjectURL
[2] http://lists.w3.org/Archives/Public/public-webapps/2010OctDec/0169.html

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/



More information about the whatwg mailing list