- From: Ian Hickson <ian@hixie.ch>
- Date: Mon, 11 Jun 2012 21:44:45 +0000 (UTC)
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- cc: HTML WG <public-html@w3.org>
On Fri, 16 Mar 2012, Boris Zbarsky wrote:
>
> Consider the following testcase:
>
> <!DOCTYPE html>
> <img
> src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAUCAIAAAALACogAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAABtJREFUKM9jFBB4z0AKYGIgEYxqGNUwqoGeGgBbDwE3IUzUhQAAAABJRU5ErkJggg==">
> <img
> src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAChJREFUSMftzUEBAAAEBLCjf2dK8NsKrJLJp84zgUAgEAgEAoFAcGUBocYBP+pqhN4AAAAASUVORK5CYII=">
> <script>
> window.onload = function() {
> var img = document.querySelector("img");
> img.src =
> "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAChJREFUSMftzUEBAAAEBLCjf2dK8NsKrJLJp84zgUAgEAgEAoFAcGUBocYBP+pqhN4AAAAASUVORK5CYII=";
> alert(img.width + " " + img.height);
> }
> </script>
>
> Every non-Gecko UA alerts "32 32". Gecko used to do the same thing before
> Firefox 4. At that point we switched to doing what the spec calls for here,
> which is that the src set starts an async fetch and the image size does not
> update until the fetch completes.
>
> Unfortunately, this does not seem to be web-compatible. People expect their
> preloaded images to synchronously update the width and height when src is set
> to them.
>
> I'm probably going to change Gecko to do that. I have no idea how to spec it,
> though, because the spec doesn't have any concept of images being preloaded,
> and I'm not quite sure it should. :(
>
> -Boris
>
> P.S. The behavior is the same with non-data: URIs; the data: URIs just made
> it easier to construct a standalone testcase.
I have tried to specify this. I'm not sure I got the timing of load events
exactly right; if not, let me know.
Testing interop on this will be... difficult, since UAs are basically
allowed to do whatever they want.
http://html5.org/tools/web-apps-tracker?from=7127&to=7128
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 11 June 2012 21:46:00 UTC