Last Comment Bug 331306 - The "load" event on images does not achieve the capture phase
: The "load" event on images does not achieve the capture phase
Status: RESOLVED WORKSFORME
:
Product: Core
Classification: Components
Component: DOM: Events (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: events
: Hixie (not reading bugmail)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-21 23:50 PST by Maciej Stachowiak
Modified: 2006-03-22 07:25 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case that shows capture phase not happening for img load event (1.69 KB, text/html)
2006-03-21 23:52 PST, Maciej Stachowiak
no flags Details

Description Maciej Stachowiak 2006-03-21 23:50:58 PST
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

Event listeners registered with a true useCapture argument on ancestors of an IMG element do not receive the "load" event. It is correct for them not to bubble, but every event on on element should achieve the capture phase.

Reproducible: Always

Steps to Reproduce:
1. Try test case to be attached shortly.
2.
3.
Actual Results:  
Capturing listeners on document and body do not fire when the image load event does. Not achieving the capture phase for "load" is contrary to DOM Level 2 Events and DOM Level 3 events. It also creates possible compatibility problems when sites write to firefox. For example, if content sets a capturing event listener for "load" on the window expecting it to fire on load of the document, it would fire for every image that loads in a conforming implementation.

See also related bug 235441 which causes capturing listeners to fire on the target of the event. The test logs:

IMG, phase: 2 target: [object HTMLDocument]
IMG, phase: 2 target: [object HTMLDocument]

As an additional bug, the event's target is the document even though it is dispatched on image elements. I'll file that one separately. Also, bug 235441 causes the capture handler on the img to fire, it should not.

Expected Results:  
Capturing listeners should have fired. Logging should be something like:

Window, phase: 1 target: [object IMG]
Document, phase: 1 target: [object IMG]
Body, phase: 1 target: [object IMG]
IMG, phase: 2 target: [object IMG]
Comment 1 Maciej Stachowiak 2006-03-21 23:52:24 PST
Created attachment 215862 [details]
test case that shows capture phase not happening for img load event
Comment 2 Maciej Stachowiak 2006-03-22 00:03:47 PST
See also related bug 331308
Comment 3 Dave Townsend [:mossop] 2006-03-22 05:34:17 PST
This appears working on trunk. Probably as a result of bug 234455.
Comment 4 Olli Pettay [:smaug] (TPAC) 2006-03-22 07:19:57 PST
(In reply to comment #3)
> This appears working on trunk. Probably as a result of bug 234455.
> 

Yep, this was fixed in bug 234455.
I'd like to fix bug 235441 too, but it is still
unclear what should happen when XBL is used.


Note You need to log in before you can comment on or make changes to this bug.