Closed
Bug 22710
Opened 25 years ago
Closed 24 years ago
[DOM] onload and onerror handler of Image object don't fire
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
M18
People
(Reporter: martin.honnen, Assigned: hjtoi-bugzilla)
References
Details
(Whiteboard: [nsbeta2-][nsbeta3+])
Attachments
(5 files)
631 bytes,
text/html
|
Details | |
83 bytes,
text/html
|
Details | |
1.69 KB,
text/html
|
Details | |
4.99 KB,
patch
|
Details | Diff | Splinter Review | |
761 bytes,
patch
|
Details | Diff | Splinter Review |
DOM level 0 client side javascript knows the Image object with onload and onerror handlers. Both do not fire in M12. Bugs is probably related to the same complaint about the IMG element http://bugzilla.mozilla.org/show_bug.cgi?id=15005 <HTML> <HEAD> <STYLE> </STYLE> <SCRIPT> function computeImageDimensions (url) { var img = new Image(); img.onload = function (evt) { alert(this.width + ':' + this.height); }; img.onerror = function (evt) { alert(evt.type); }; img.src = url; } computeImageDimensions('http://www.mozilla.org/images/mozilla-banner.gif'); computeImageDimensions('http://www.mozilla.org/images/mzilla-banner.gif'); </SCRIPT> </HEAD> <BODY> <A HREF="javascript: void 0" ONCLICK="computeImageDimensions('http://www.mozilla.org/images/mozilla-banner.gi f'); return false;" > image object's dimensions </A> </BODY> </HTML>
Reporter | ||
Comment 1•25 years ago
|
||
Reporter | ||
Comment 4•25 years ago
|
||
onload and onerror for the Image object (and the IMG element) have been around since js1.1/NN3. Standard application is checking for a test image on a server to see whether the server is up. Image preloading code which is quite common also often uses the onload handler. I am not sure what the aim for beta is but I would urge you to aim to make DOM level 0 stuff work so that people can rely on the features they are used to. I think it is pretty annoying when I try to use DOM level 1 stuff like changing the image dimensions dynamically to find out that the DOM level 0 stuff I am used to work with is broken.
Comment 5•25 years ago
|
||
Yeah, Its not very common. I agree to that, but I think there are some people who use it. And dom-0 stuff is pretty important to work because people are so much used to it now.
Comment 6•25 years ago
|
||
PDT thought this was a pretty rare need, and set status to PDT-. If we are off base, please add comment, and raise the issue again. Thanks, Jim
Whiteboard: [PDT-]
Reporter | ||
Comment 7•25 years ago
|
||
http://www.deja.com/dnquery.xp?DBS=2&ST=MS&VW=&QRY=%22img.onload%22+%7C+%22image .onload%22&svcclass=dnserver brings up over 100 postings on that topic (and it searches only those where people write img.onload or image.onload where people might use arbritrary other variable names)
Comment 8•25 years ago
|
||
This is an important issue, but I'll live with the PDT- designation. This is high on the M15 fix list.
Status: NEW → ASSIGNED
Target Milestone: M15
I don't think this is quite as rare as thought. Any site using the Webcam32 video streaming software relies on this. Check out: bug 17067 A google search on "webcam32" comes up with 3,229 hits, BTW.
Comment 10•24 years ago
|
||
Unfortunately this didn't make into M15, trying for M16
Target Milestone: M15 → M16
Comment 12•24 years ago
|
||
Putting on [nsbeta2+][6/01] radar. This work must be done by 06/01 or we may pull this for PR2.
Comment 13•24 years ago
|
||
I do not believe this is a platform-specific item. -WD
OS: Windows 98 → All
Comment 14•24 years ago
|
||
Tom, I think you're the man for this bug!
Assignee: vidur → joki
Status: ASSIGNED → NEW
Comment 15•24 years ago
|
||
Changing from [6/01] to [6/15]
Whiteboard: [nsbeta2+][6/01] → [nsbeta2+][6/15]
Comment 16•24 years ago
|
||
Cleaning up status whiteboard by marking beta2 minus (6/15 has passed) This sounds like a signiicant item for compatability with existing sites. Unless this is already fixed, please think about nominating for beta3, or filing a help-wanted on mozilla.
Whiteboard: [nsbeta2+][6/15] → [nsbeta2-]
Comment 17•24 years ago
|
||
M16 has been out for a while now, these bugs target milestones need to be updated.
Comment 18•24 years ago
|
||
Adding [DOM] prefix to bugs related to DOM Level 0, 1, or 2 compatibility/compliance.
Status: NEW → ASSIGNED
Summary: onload and onerror handler of Image object don't fire → [DOM] onload and onerror handler of Image object don't fire
Assignee | ||
Comment 20•24 years ago
|
||
Nominating for nsbeta3. It seems important enough to me.
Keywords: nsbeta3
Comment 21•24 years ago
|
||
onload is an important property, very often used whenever preloading images.
Comment 22•24 years ago
|
||
I just noticed this on build 2000080104 under MacOS 8.6, while developing an actual application that needs it (although setInterval checking Image.complete is a cumbersome alternative). Changing Platform to All. Here's a one-or-two-line test case: <IMG SRC="http://mozilla.org/images/mozilla-banner.gif" onload="alert('Loaded.')">
Hardware: PC → All
Comment 23•24 years ago
|
||
Comment 24•24 years ago
|
||
Unfortunately, image.complete doesn't trigger either ! On www.bestmat.be/en/service.html body onload="ldbig()" doesn't change "arrow" image; timer01 never ends... var curpict= "../jpegs/atelier"; var arrow_1= new Image(); arrow_1.src= "../gifs/arrow_1.gif"; var max= new Image(), timer01= null; function dspl(){ if(max.complete && document.images["arrow"]){ document.images["arrow"].src= arrow_1.src; clearInterval(timer01)} } function ldbig(){max.src= curpict +"b.jpg"; timer01= setInterval("dspl()",100)}
Assignee | ||
Comment 25•24 years ago
|
||
I am the virtual joki.
Assignee: joki → heikki
Status: ASSIGNED → NEW
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 26•24 years ago
|
||
Per discusion with Nisheeth, marking nsbeta3+. Will email ekrock to verify.
Whiteboard: [nsbeta2-] → [nsbeta2-][nsbeta3+]
Assignee | ||
Updated•24 years ago
|
Priority: P3 → P2
Comment 27•24 years ago
|
||
Comment 28•24 years ago
|
||
Not only 'onload' event doesn't fire when image loaded : complete, width and height properties aren't updated either.
Comment 29•24 years ago
|
||
Once bug 28277 is fixed this should be easier to fix, the problem right now is that the HTMLImageElement doesn't register a callback to the image loader and thus it never knows when the image has loaded. Once a callback is in place the fireing of the events could be added to the same callback...
Depends on: 28277
Comment 30•24 years ago
|
||
*** Bug 50713 has been marked as a duplicate of this bug. ***
Comment 31•24 years ago
|
||
PDT agrees P2
Assignee | ||
Comment 32•24 years ago
|
||
Assignee | ||
Comment 33•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Keywords: review
Whiteboard: [nsbeta2-][nsbeta3+] → [nsbeta2-][nsbeta3+][fixinhand]
Assignee | ||
Comment 34•24 years ago
|
||
*** Bug 46046 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 35•24 years ago
|
||
Fix checked in. Please note that there are at least some open problems still, but they are not covered by this bug. Namely, the load event for the document load can fire before the image load. Also, you can have several alert dialogs open.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Keywords: review
Resolution: --- → FIXED
Whiteboard: [nsbeta2-][nsbeta3+][fixinhand] → [nsbeta2-][nsbeta3+]
Comment hidden (collapsed) |
You need to log in
before you can comment on or make changes to this bug.
Description
•