Closed Bug 165305 Opened 23 years ago Closed 23 years ago

"this.x" does not check for x in parent nodes

Categories

(Core :: Layout: Form Controls, defect)

x86
Windows 98
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: hfmeza, Assigned: john)

Details

Attachments

(2 files)

Apparently the onchange event is not being correctly triggered in a web form. Consider the following code (extracted from www.canalsony.com) <script> function redir() { window.location.href = this.listaserie.serielista.value; } </script> <body> <div align="right"> <form action="redirserie.asp" name="listaserie" method="post"> <select name="serielista" size="4" onchange="redir()"> <option value="/programacao/hot_sites/series/3rdrock/3rdrock.asp">3rd Rock from the Sun</option> <option value="/programacao/hot_sites/series/7th_heaven/7th_heaven.asp">7th Heaven</option> <option value="/programacao/hot_sites/series/according_to_jim/according_to_jim.asp">According to Jim</option> <option value="/programacao/hot_sites/series/asif/asif.asp">As If</option> </select> </form> </div> </body> </html> When the user clicks on one of the select options, the browser should be redirected accordingly (which happens when the page is tested in Opera 6.01). When this is done in Mozilla 1 rc2 2002051006, nothing happens.
Browser, not engine. This probably should be sent to Event Handling, but allow me to send to HTML Form Controls first in case this is a known issue -
Assignee: rogerl → jkeiser
Component: JavaScript Engine → HTML Form Controls
QA Contact: pschwartau → tpreston
Attached file Minimized Testcase
OnChange fires fine, but JS can't find the select. The problem is that "this.formname" doesn't work, because formname is not a property of this (which is the select node). If you remove "this" it works, as the testcase shows--that is because to find variables we look up the tree from the node until we find the variable as an attribute. I heavily suspect this is INVALID.
Marking INVALID but CC'ing jst and bz in case this was an unknown issue (I suspect it wasn't).
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Summary: onchange event not being triggered? → "this.x" does not check for x in parent nodes
I've been looking into this bug, and I believe the problem is not only related to this.x, but to something that appears to be variable scope. I think it's probably correct in relation to javascript compliance, but since I don't know that much about javascript, and it works on opera and ie, i'll post it here. IN the test case, there are 3 text inputs, the first has a onchange:"alert(textinput.value)", that works perfectly. The third one calls a function sending the form as a parameter. THe function does the same alert. It works. The second one calls the function, without sending a parameter, and it doesn't work, because, according to the console, the form is not defined. Probably it's because of the form not being accesible from the function, but since it works 2 other browsers, maybe it could be implemented for compatibility's sake? I'm sorry if this bug is considered closed, or if this is totally senseless.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: