img tag not supporting scripted onclick

VERIFIED FIXED

Status

()

Core
DOM: Core & HTML
P3
normal
VERIFIED FIXED
18 years ago
18 years ago

People

(Reporter: Dylan Schiemann, Assigned: joki (gone))

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixinhand][nsbeta3+])

Attachments

(2 attachments)

(Reporter)

Description

18 years ago
The onClick event is captured properly when embedded in the tag
<img src="blank.jpg" onClick="alert('embedded click')"> or when using the 
addEventListener("click",functionName,false), but not with the simple 
document.getElementById(idOfImage).onclick = addHandler;
(Reporter)

Comment 1

18 years ago
Created attachment 9430 [details]
Testcase

Comment 2

18 years ago
I can reproduce this bug on PowerMac G3 with 160 MB RAM running Mac OS 8.6. 
Mozilla Build 20000053108. 

The test page works correctly on Explorer 5 Mac but not in Navigator 4.7.3 nor in 
Mozilla.
Is this in any DOM spec (I can't find it), or is it just a bug for IE5-parity?
(Reporter)

Comment 4

18 years ago
I would think this would fall under DOM Level 0 or the Netscape 3 event model, 
which was never implemented for most elements.  This behavior is supported in 
M15 for virtually every element in a document except img.  If this is something 
worth fixing which I think it is, I guess a better testcase is needed to see 
which elements support this and which do not.
Joki, I played around with this a bit and it looks like we really don't handle

dynamically setting img.onclick, could you have a look?
Assignee: jst → joki
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 6

18 years ago
Fix in hand.  Attaching diff, not sure when this will get approval for checkin.
Status: NEW → ASSIGNED
Whiteboard: fix in hand, diff attached.
(Assignee)

Comment 7

18 years ago
Created attachment 10010 [details] [diff] [review]
fix for bug
*** Bug 42693 has been marked as a duplicate of this bug. ***
Sorry, typo in the bug number. bug 42693 is not a duplicate of this bug.

Updated

18 years ago
Keywords: testcase
(Assignee)

Comment 10

18 years ago
Adding [fixinhand] to allow easier sorting while waiting for nsbeta3 tree 
checkins.

Nominating nsbeta3.
Keywords: testcase → nsbeta3
Whiteboard: fix in hand, diff attached. → [fixinhand]

Comment 11

18 years ago
Marking nsbeta3+...
Whiteboard: [fixinhand] → [fixinhand][nsbeta3+]

Comment 12

18 years ago
Joki's fixes have been checked in by saari.  Marking fixed.
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 13

18 years ago
Nisheeth, Some how I'm not able to see the alert. I guess it is still there. I 
tried it with Win-95 too, but it does not work.
Reopening right now, if you think it is fixed please let me know like that.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 14

18 years ago
Well the test case seems to not have an image with it.  If you try this test 
case with a valid image it works just fine.  I don't know that we are trying to 
support events over broken images.
Status: REOPENED → RESOLVED
Last Resolved: 18 years ago18 years ago
Resolution: --- → FIXED
Verified fixed on NT build around 2000-09-25.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.