Closed Bug 148725 Opened 23 years ago Closed 15 years ago

yourguide.com.au - document.aName.submit() fails due to scoping(?)/aliasing(?)

Categories

(Tech Evangelism Graveyard :: English Other, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: xpusostomos, Unassigned)

References

()

Details

(Whiteboard: [bug248549notfixed])

Attachments

(1 file, 1 obsolete file)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0rc2) Gecko/20020510 BuildID: 2002051006 The above form and javascript doesn't work, but it does in IE. Reproducible: Always Steps to Reproduce: 1.Put in a comment etc. 2.Press "Submit" 3. Actual Results: Nothing happens Expected Results: Form submitted
Hmm, interesting. The script fails doing 'document.aFormName.submit()' which should be legal. It appears that some odd scoping issue is clobbering the submit property of the Form object. This is the simplest testcase that I could reduce this into. (Ignore the fact that the testcase doesn't make any sense; it's just what's left over from a form validation scheme that the original URL was using (encoding meta-information in each element's NAME attribute)). <html> <head> <script> function checkform() { len = document.addopinion.elements.length; for (i = 0; i < len; i++) { split_name(document.addopinion[i].name); } document.addopinion.submit(); } function split_name(name) { ary = name.split(","); document.addopinion[i].name = ary[0]; } </script> </head> <body> <form action="http://www.mozilla.org/" name="addopinion" method="GET"> <input type="text" name="subject,Subject,0,0" value="Try to submit"> <input type="button" value="Submit" name="submit,Submit,0,0" onClick="return checkform()"> </form> </body> </html>
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Form / Javascript not working → document.aName.submit() fails due to scoping(?)/aliasing(?)
Attached file minimal testcase from above; (obsolete) —
Oh, wait. Simpler. What a pain if we have to emulate that. <script> function checkform() { alert("1: " + document.aForm.submit); alert("2: " + document.aForm.whatever); document.aForm[0].name = 'submit'; alert("3: " + document.aForm.submit); document.aForm.submit(); } </script> </head> <body> <form action="http://www.mozilla.org/" name="aForm" method="GET"> <input type="button" value="Whatever" name="whatever" onClick="return checkform()"> </form>
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
... although the second testcase works in Nav4x/win32
Keywords: 4xp
cc'ing Boris, because this looks the same as bug 148782 "Javascript works in 4.75 but not in Mozilla build" bug 148793 "Defined FORM object ignores submit() method" In each of those cases, as here, there is an HTML element given the name "submit". The only difference is that here, the element is named dynamically and not statically as in the other two bugs. Q: is it just a coincidence that we've had three different reports on this in one day???
*** Bug 148885 has been marked as a duplicate of this bug. ***
cc'ing David from the duplicate bug 148885. That makes four reports on this problem in 24 hours!
Seems like an odd coincidence. I tried the above testcase in 3/17/02 and 12/16/01 trunk builds, and they both fail the same way.
I think Hixie filed a more completely-stated bug against which this could be dup'ed, actually. /be
*** This bug has been marked as a duplicate of 147058 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
This is not a dupe of Hixie's scoping bug, we scope things exactly like IE does here, the problem here is that form.submit is a callable object in IE even if it's an image or a form control.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
This has never "worked" in Mozilla, so the fact that we got all these reports is basically a coincidence, yes. Phil, what exactly does ECMA say about what should happen when foo.bar() is called and foo.bar is not a Function object?
bzbarsky, there's nothing in ECMA to help here. A "host object" can be callable, in addition to a function object. SpiderMonkey supports callable objects, too -- see JSClass.call. /be
Actually, the problem here is actually not that inputs named submit in IE are callable objects, the problem is that the name to object hash off of form[] is static in IE and live in mozilla, i.e. setting the name of an input to 'foo' in mozilla will make the input reachable as form.foo, whereas that is not the case in IE. From what I can tell, that's simply a bug in IE, and I don't see that we want to emulate that bug in mozilla. Over to evangelism.
Assignee: jst → doron
Status: REOPENED → NEW
Component: DOM Level 0 → US General
Product: Browser → Tech Evangelism
QA Contact: desale → zach
Version: other → unspecified
Note dynamic name assignment to 'submit' does occur at this site, but not in the duplicate bugs above. For example, from bug 148782: <input type="image" name="submit" etc.
What's the final decision on this bug ?
Mozilla does the right thing here IMNSHO, form.elements should be live, just like all other node lists are, so if you change the name of a form control it should appear in form.elements with that name. I find it hard to justify any other kind of behavior here.
-> en non us
Assignee: doron → momoi
Component: US General → English: Non-US
QA Contact: zach → jeesun
Summary: document.aName.submit() fails due to scoping(?)/aliasing(?) → yourguide.com.au - document.aName.submit() fails due to scoping(?)/aliasing(?)
Mass reassigning English-Other bugs to general default assignees.
Assignee: momoi → english-other
QA Contact: jeesun → english-other
Keywords: 4xp
Whiteboard: [bug248549notfixed]
INCOMPLETE due to lack of activity since the end of 2009. If someone is willing to investigate the issues raised in this bug to determine whether they still exist, *and* work with the site in question to fix any existing issues, please feel free to re-open and assign to yourself. Sorry for the bugspam; filter on "NO MORE PRE-2010 TE BUGS" to remove.
Status: NEW → RESOLVED
Closed: 23 years ago15 years ago
Resolution: --- → INCOMPLETE
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: