So I encountered the big image width height problem today, wherein a particular browser (Chrome v31.0.1626.5) gives me 0 width for an image selector using Jquery's .width() .
I have the below line in a Button's click handler after the image is loaded(or seems to be after it) in a Jquery UI dialog.
var imageWidth = $("#myImageSelector").width();
// imageWidth = 0 in Chrome
// imageWidth = 1024 (which is the actual image width) in Firefox v23
So after a bit of research on the same, I found that I would be able to access the height and width properties of the image only after the image is loaded (here and here) and that there are some race conditions...
1. What is this race condition that is in question here?
2. How does Chrome deal with images differently than Firefox? And is it only with HTMLImageElement or other DOM elements too in general? Why is the width shown properly in Firefox? (Is it because the above said race conditions are handled more elegantly in Firefox?)
P.S. : Any references for further reading are much appreciated.