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




17 years ago
17 years ago


(Reporter: hfmeza, Assigned: john)


Windows 98

Firefox Tracking Flags

(Not tracked)



(2 attachments)



17 years ago
Apparently the onchange event is not being correctly triggered in a web form.

Consider the following code (extracted from www.canalsony.com)

function redir()
window.location.href = this.listaserie.serielista.value;

      <div align="right">
       <form action="redirserie.asp" name="listaserie" method="post">
      <select name="serielista" size="4" onchange="redir()">

value="/programacao/hot_sites/series/3rdrock/3rdrock.asp">3rd Rock from the
value="/programacao/hot_sites/series/7th_heaven/7th_heaven.asp">7th Heaven</option>
to Jim</option>
value="/programacao/hot_sites/series/asif/asif.asp">As If</option>

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.

Comment 1

17 years ago
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

Comment 2

17 years ago
Created attachment 97108 [details]
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.

Comment 3

17 years ago
Marking INVALID but CC'ing jst and bz in case this was an unknown issue (I
suspect it wasn't).
Last Resolved: 17 years ago
Resolution: --- → INVALID
Summary: onchange event not being triggered? → "this.x" does not check for x in parent nodes

Comment 4

17 years ago
Created attachment 97127 [details]
testcase related to this.x

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

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.