Closed
Bug 309573
Opened 19 years ago
Closed 19 years ago
javascript function named onclick is used as body onclick
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: bugzilla, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b5) Gecko/20050920 Firefox/1.4 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b5) Gecko/20050920 Firefox/1.4 I was creating a test script to test the document.getElementsByName and accidentally named my javascript function onclick (I was going to name it test). This caused the function to be called everytime I clicked on the page. No matter if it is right button, left button or where it is. So, I decided to see what if I changed the function to onblur. Bad idea, couldn't get out of an infinite loop of alerts. But it looks like that the name onclick is causing Firefox to consider it as its onclick handler. I don't think that is how it should work, but I might be wrong. Reproducible: Always Steps to Reproduce: 1. Go to the web page 2. Click where ever you like 3. Actual Results: Alert message is shown Expected Results: Alert message should never be shown since the function should never be called as it is not set as an event handler to any of the items.
Comment 1•19 years ago
|
||
Everybody sets on*** handlers using window.on*** = function() { ... }, so this has to work. |window| is the global object on HTML pages. Therefore when you declare an onclick function, a property with that name is created in the global object (window.onclick) pointing to your function. It works how it supposed to work. Marking invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•