• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Image.complete property trouble in Safari

 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran into some trouble with Image.complete.

Is this not a standard property?

In a nutshell it never completed in Safari (I'm sorry, I can't remember which version I am running at work). If the image existed in the browser cache before the script was called, then the script was able to access it, but it never actually reported that it was complete.

Has anyone else run into anything similar?

Shall I dig up some juicy details?

I'm sort of hoping there is some obscure bug like the very lame case issue that I recently ran into with IE and dynamic image maps when experimenting with a kludgy, circular, rotating, thingamajigg. Enough said!
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never heard of this property and it's not part of the W3C Image element specification.
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link, Bear!

In Christian Heilmann's "Beginning JavaScript Development with DOM Scripting and Ajax" (Apress) he mentions a bunch of properties for images (page 185):


border: The value of the border attribute in HTML
name: The name attribute of the img tag
complete: A property that is true if the image has finished loading (read-only - you cannot change this attribute)
height: The height of the image (in pixers -/ returned as an integer)
width: The width of the image (in pixels - returned as an integer)
hspace: The horizontal space around the image
vspace: The vertical space around the image
lowsrc: The image preview as defined in the attribute of the same name
src: The URL of the image



Since Christian Heilmann is a big fan of standard DOM features and does a very good job of describing how to use them well (he also does a great job of explaining how it used to be done, and why that isn't necessarily a great idea anymore)... and because he didn't issue any caveats about the image properties, I sort of assumed that these were standard.

And we all know what happens when we assume!

The list at w3.org doesn't have complete and lowsrc, but does have additional properties:
- align
- alt
- isMap
- useMap
- longDesc
 
Bear Bibeault
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are actually a lot of non-standard properties that are in general use, and are supported across browsers because they are popular (innerHTML, for example). Apparently, Image.complete isn't one of them.

Does the onload property of the image elements not work for you?
[ May 24, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. I assume this is to test when an image is dynamically loaded rather than at page load?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would also suggest looking into using onload and onerror to get the same sort of result.

Eric
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yepp, dynamic image load rather than page load. The image we are loading provides a "zoom" function - and is HUGE (allowing a visitor to see fabric quality and garment details before deciding to buy).

I didn't even realize we could try image.onload. Talk about missing the obvious!

Thanks for the help.
[ May 25, 2008: Message edited by: Katrina Owen ]
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic