Image widget and IE

106 views
Skip to first unread message

Eduard Dudar

unread,
Sep 13, 2007, 5:36:42 AM9/13/07
to Google Web Toolkit
Hi GWT community!

I have a trouble with loading images under IE browser. Sources for
images are existent and images are valid, but IE shows only empty
squares with colored figures.

I've intalled ID dev toolbar and drill down into HTML code generated
by GWT js.
Here is what I've seen in code:
<IMG class="gwt-Image" __eventBits="229501" __widgetID="6"
__pendingSrc="http://xxx.png" />

Searching across the google gave me nothing in topic of
"__pendingSrc".

But! When I manully added "src" attribute to <IMG> tag I received:
<IMG class="gwt-Image" src="http://xxx.png" __eventBits="229501"
__widgetID="10" __pendingSrc="http://xxx.png" /> and images correctly
shows on screen.

In Java-GWT code I use only Image widget.

Could pleaswe anyone say what going on here?

Reinier Zwitserloot

unread,
Sep 13, 2007, 6:24:58 AM9/13/07
to Google Web Toolkit
IE is buggy. __pendingSrc is a GWT-specific workaround.

Specifically,

if you create 10 image objects, all pointing to the same image, the
proper behaviour for the browser is to download this image ONCE.

IE downloads it 10 times. This is, in a word, BAD.

GWT works around it by not actually initializing images (=setting up
the .src property) until any other images with the same url have
completed loading. (IE will grab an image from cache if it has been
fully loaded already).

GWT keeps track of the src it's trying to become with __pendingSrc.


If you're having trouble loading the image you appear to be doing
something strange. Possibly the first load somehow gets an error
message, but subsequent loads don't. At any rate, your bug is
elsewhere.

sal...@gmail.com

unread,
Sep 14, 2007, 9:40:52 AM9/14/07
to Google Web Toolkit
Eduard,

I have had the same problem with loading Images in my code. Try
searching the forums or issue tracker for "__targetSrc", as this is
the name of the attribute set by my environment. I moved on by
creating a wrapper method for Image that uses .setURL(path) and
DOM.setElementAttribute(Image.getElement(), "src", path); Based on my
experience with the ImageBundle implementation, I wouldn't go hunting
around your code for a bug thats causing this behavior. Good luck

Dav

Reply all
Reply to author
Forward
0 new messages