- From: Olli Pettay <Olli.Pettay@helsinki.fi>
- Date: Thu, 17 Mar 2011 20:08:08 +0200
On 03/17/2011 07:41 PM, Lachlan Hunt wrote: > 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]. Ok, some kind of DOMURL would make sense. Perhaps getStreamURL could return that kind of url. The object wouldn't need to be a stream. I need to write some pseudo-js code to figure out how this all could work. > > [1] http://dev.w3.org/2006/webapi/FileAPI/#dfn-createObjectURL > [2] http://lists.w3.org/Archives/Public/public-webapps/2010OctDec/0169.html >
Received on Thursday, 17 March 2011 11:08:08 UTC