W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2011

[whatwg] Stream API Feedback

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Thu, 17 Mar 2011 18:41:56 +0100
Message-ID: <4D8247E4.7050309@lachy.id.au>
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];
   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
Received on Thursday, 17 March 2011 10:41:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:31 UTC