image named 'submit' inside of form shadows the method form.submit()

RESOLVED INVALID

Status

()

Core
DOM: Core & HTML
RESOLVED INVALID
16 years ago
16 years ago

People

(Reporter: bc, Assigned: jst)

Tracking

Trunk
mozilla1.0.1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [HAVE FIX], URL)

Attachments

(3 attachments, 2 obsolete attachments)

(Reporter)

Description

16 years ago
The url contains a page with a form named |investForm| which contains a link
around an image that is named |submit|. 

document.investForm.submit points to the image and not the submit function for
the form. This does not agree with Nav4.
(Reporter)

Comment 1

16 years ago
Created attachment 85676 [details]
testcase. alert(document.thisform.thisimage)
(Assignee)

Comment 2

16 years ago
For backwards compatibility reasons with 4x we can't not expose images by their
name on form objects, but we can special case form.submit to never be shadowed
by any form controls or images on a page. Morphing bug...
Status: NEW → ASSIGNED
OS: Windows 2000 → All
Hardware: PC → All
Summary: image with name inside of form becomes property of form object → image named 'submit' inside of form shadows the method form.submit()
Target Milestone: --- → mozilla1.0.1
(Assignee)

Comment 3

16 years ago
Created attachment 85815 [details]
Testcase with form.submit() and <img name='submit'>
Attachment #85676 - Attachment is obsolete: true
(Assignee)

Comment 4

16 years ago
Created attachment 85818 [details] [diff] [review]
Fix, don't let form controls or images named submit shadow form.submit.
(Assignee)

Updated

16 years ago
Whiteboard: [HAVE FIX]
(Assignee)

Comment 5

16 years ago
Created attachment 85821 [details] [diff] [review]
Same for form.reset()...
Attachment #85818 - Attachment is obsolete: true

Comment 6

16 years ago
Comment on attachment 85821 [details] [diff] [review]
Same for form.reset()...

sr=vidur
Attachment #85821 - Flags: superreview+

Comment 7

16 years ago
Created attachment 85826 [details]
Testcase

This testcase shows which "submit" is used.  In IE 6, the input is used, not
the method.  And that seems right to me.
(Assignee)

Updated

16 years ago
Attachment #85826 - Attachment is patch: false
Attachment #85826 - Attachment mime type: text/plain → text/html
(Reporter)

Comment 8

16 years ago
Ok. I must have been on crack. jkeiser is right. nav4, IE6 and Mozilla agree
that an input named submit or even a simple image named image in the form is
exposed the same way as document.formname.submit. -> invalid
(Reporter)

Comment 9

16 years ago
but why does IE6 submit the form on the ingdirect site?
In IE, you have this weird thing where form.submit can be an image or input 
while form.submit() calls the form's submit method.  This behavior is a 
violation of the ECMA spec.
(Reporter)

Comment 11

16 years ago
ok. god i hate IE. sorry for all the extra work. ->invalid.
Status: ASSIGNED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → INVALID
(Assignee)

Comment 12

16 years ago
I *believe* we could make mozilla work that way too, at least for form controls,
but for images it would be hard (since we don't know what form they belong to).
I can't say I want to do that tho, but if we really have to...

Comment 13

16 years ago
*** Bug 160692 has been marked as a duplicate of this bug. ***
*** Bug 160692 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.