Closed Bug 283392 Opened 20 years ago Closed 20 years ago

naming the onload handler "onload" causes infinite recursion

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 201828

People

(Reporter: ceubanks, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 It seems that naming the onload handler "onload" causes problems. This works just fine in IE. Test Case: <html> <script lang="javascript"> function onload(){ alert("yo!"); } </script> <body onload="onload();"> </body> </html> Steps: 1) hit the above page 2) see that no alert "yo!" occurs. 3) scratch head 4) look at javascript console 5) see "infinite recursion" message Reproducible: Always Steps to Reproduce: 1) hit the above page 2) see that no alert "yo!" occurs. 3) scratch head 4) look at javascript console 5) see "infinite recursion" message Actual Results: no javascript alert Expected Results: should see javascript alert
Attached file reporter´s testcase
start JS-console load testcase see Error: too much recursion same testcase can be made replacing 'onload' by 'onclick', or 'onfocus'.
Keywords: testcase
The onload handler on body is the same as window.onload... which is the same as a function in window scope named onload. That's in Mozilla. What IE does is a lot more complicated; see comments in bug 201828. *** This bug has been marked as a duplicate of 201828 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: