Closed Bug 41191 Opened 25 years ago Closed 24 years ago

img tag not supporting scripted onclick

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: mail, Assigned: joki)

Details

(Whiteboard: [fixinhand][nsbeta3+])

Attachments

(2 files)

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;
Attached file Testcase
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?
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
Fix in hand. Attaching diff, not sure when this will get approval for checkin.
Status: NEW → ASSIGNED
Whiteboard: fix in hand, diff attached.
Attached patch fix for bugSplinter Review
*** 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.
Keywords: testcase
Adding [fixinhand] to allow easier sorting while waiting for nsbeta3 tree checkins. Nominating nsbeta3.
Keywords: testcasensbeta3
Whiteboard: fix in hand, diff attached. → [fixinhand]
Marking nsbeta3+...
Whiteboard: [fixinhand] → [fixinhand][nsbeta3+]
Joki's fixes have been checked in by saari. Marking fixed.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
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 → ---
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
Closed: 25 years ago24 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.

Attachment

General

Created:
Updated:
Size: