[Celerity-users] Celerity::Image#loaded? is incorrect (I think)
Daniel Radetsky
dradetsky at gmail.com
Tue Jul 7 01:41:30 EDT 2009
Folks:
Been doing some work with Celerity/HtmlUnit recently. I noticed that
the function 'Celerity::Image#loaded?', which I assume is supposed to
do nothing but determine if the image has already been loaded, does not
do that. What it does is attempt to download the image, and returns
false if it fails to do so. This is because (if I understand correctly)
HtmlUnit does not by default download images (for performance reasons).
It only downloads them if they have an onload handler. Ordinarily the
function will call its way down to downloadImageIfNeeded, and then
download the image.
Or maybe I'm wrong. It's happened before.
If I'm right, another option would be to call getWebResponse(false)
(i.e. don't actually try to fill the web response object if it's empty)
and check for null.
--Daniel
More information about the Celerity-users
mailing list