W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [FileAPI] createObjectURL isReusable proposal

From: Bronislav Klučka <Bronislav.Klucka@bauglir.com>
Date: Mon, 30 Jan 2012 16:40:18 +0100
Message-ID: <4F26B9E2.7070008@bauglir.com>
CC: public-webapps@w3.org


On 30.1.2012 16:14, Glenn Maynard wrote:
> 2012/1/30 Bronislav Klučka <Bronislav.Klucka@bauglir.com 
> <mailto:Bronislav.Klucka@bauglir.com>>
>
>     And how? Using src attribute? that would have to be changed to
>     accept both string and Blob object? What it would return on get
>     operation? Libraries managing images (lightboxes) would have to
>     consider, what does src mean? Or do you propose other attribute?
>     What would then be in src?
>
>
> img1 = document.getElementById("my-image");
> img1.src = myBlob;
> assert(img1.src == myBlob);
> img2 = document.getElementById("my-other-image");
> img2.src = img1.src; // works as always; you can't do this with 
> auto-releasing object URLs
If you are worried about autoreleasing URLs in such cases, do not use 
them! Why on Earth would you use autoreleasing URLs when you are using 
the URL twice?
img1 = document.getElementById("my-image");
img1.src = URL.createObjectUrl(myBlob);
img2.src = img1.src;
should work like a charm and the URL and blob will be released as soon 
as all references will be 0 (destroying the image)

>
> This is trivially simple for users to understand, and doesn't raise 
> any of the hard issues that auto-releasing object URLs do.
We are introducing more and more complex technologies, JS is no longer 
to move stuff on page, one have to learn what he/she is doing and why.

>
> The main question is innerHTML/outerHTML, where the object can't be 
> represented; it would need to be exposed as a placeholder string. 
>  (However, auto-release object URLs break many uses of these too, 
> since the URL is no longer valid!)
No problem with permanent Blob URL at all

> It means you can't use this with most approaches to HTML templating in 
> JS, which is annoying.  That said, there have been various suggestions 
> for augmenting HTML-like templating, and it could be made possible, eg.:
>
> document.createTemplatedElement("<img width=${width} height=${height} 
> src=${myImage}>", {myImage: myBlob, width: 800, height: 600});
dtto

and again
img1 = document.getElementById("my-image");
img1.src = myBlob;

what should img1.src return? Blob? really? after 20 year you want to 
change it?

BTW why is there no Blob.URL anymore?

Brona
Received on Monday, 30 January 2012 15:40:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:50 GMT