Closed Bug 80510 Opened 23 years ago Closed 23 years ago

events set with javascript don't work when the element has no event attributes

Categories

(Core :: DOM: Events, defect, P2)

defect

Tracking

()

VERIFIED WORKSFORME
mozilla0.9.3

People

(Reporter: sjoerd, Assigned: joki)

Details

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; COM+ 1.0.2204)
BuildID:    2001051104

When I set an onclick handler like

element.onclick=new Function('','alert("onclick works")')

it only works when the element already has an event attribute set in the HTML 
source. I guess there is an optimization that checks if an element is dynamic 
or not???

Reproducible: Always
Steps to Reproduce:
see attachment
click on each sentence

Actual Results:  only 2 of 4 sentences fire the onclick event

Expected Results:  all sentences should fire the onclick event, when clicked
Summary: events set with javascript don´t work when no event attributes → events set with javascript don't work when the element has no event attributes
Target Milestone: --- → mozilla0.9.2
Also happens on Windows 98 and RedHat Linux
OS: Windows 2000 → All
Hardware: PC → All
Priority: -- → P2
It works again for me with windows build 2001060604
All lines fire the onclick again.

Can somebody verify?
Moving lower priority bugs out of .9.2 milestone.
Target Milestone: mozilla0.9.2 → mozilla0.9.3
works for me on build 2001071903 win32
Marking WFM (it worksforme also).
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
Yep, works now. Verifying.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: