Closed
Bug 148782
Opened 22 years ago
Closed 21 years ago
<img name="submit">, anywhere on page, shadows form.submit()
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.4beta
People
(Reporter: andrejohn.mas, Unassigned)
References
()
Details
(Keywords: regression, Whiteboard: [HAVE FIX])
Attachments
(3 files, 4 obsolete files)
100 bytes,
text/html
|
Details | |
109 bytes,
text/html
|
Details | |
12.14 KB,
patch
|
caillon
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0rc3) Gecko/20020523 BuildID: 2002052306 When I try logging into the website specifying user id and password and then hit go nothing happens. The same page in Netscape 4.75 and IE 5 both take me to the e-mail index. Since it works in 4.75 this is probably evidence that this is a general Javascript problem, rather than IE specific Javascript. Looking in the Javascript console I get the following error: document.loginForm.submit is not a function http://www1.sympatico.ca/help/local/bell/getemailloginform.html Line: 779 Reproducible: Always Steps to Reproduce: 1. Type in user id and password 2. Hit go 3. Actual Results: No action and the following entry in the Javascript log: document.loginForm.submit is not a function http://www1.sympatico.ca/help/local/bell/getemailloginform.html Line: 779 Expected Results: Taking me to the index of the mail page
Comment 1•22 years ago
|
||
->Browser-General (probably DOM0 or Evang, but I'm having trouble getting to the JS right now)
Assignee: rogerl → Matti
Component: JavaScript Engine → Browser-General
QA Contact: pschwartau → imajes-qa
Comment 2•22 years ago
|
||
<input type="image" name="submit" src="/help/local/bell/images/topnav/go2b.gif" alt="go" border="0" align="bottom"> So form.submit is the image object (this is true in IE/Moz/NS4). Now form.submit() should take that object and execute it as a function, per the ECMA spec. Mozilla does this. IE and NS4 for some reason do not. So this site is relying on a bug in IE and NS4, basically. Fixing this bug would require a lot of work and would be a violation of the ECMA specification, so tech evang.
Assignee: Matti → momoi
Status: UNCONFIRMED → NEW
Component: Browser-General → The Americas
Ever confirmed: true
OS: Windows 2000 → All
Product: Browser → Tech Evangelism
QA Contact: imajes-qa → jonrubin
Hardware: PC → All
Version: other → unspecified
Comment 3•22 years ago
|
||
*** Bug 148793 has been marked as a duplicate of this bug. ***
Comment 4•22 years ago
|
||
Inputs of type "image" should not be exposed as properties of a form object, this is a regression (from way way back). Taking bug, and fix coming up...
Component: The Americas → DOM Level 0
Product: Tech Evangelism → Browser
Target Milestone: --- → mozilla1.1alpha
Version: unspecified → other
Comment 6•22 years ago
|
||
Comment 7•22 years ago
|
||
Comment on attachment 86484 [details] [diff] [review] Proposed fix, and some random cleanup... Duh, that wasn't the problem at all...
Attachment #86484 -
Attachment is obsolete: true
Comment 8•22 years ago
|
||
Ok, so the problem here is that there's an *image* element named submit (i.e. not an input of type image, rather an <img name="submit">) on the page and that's what's shadowing form.submit(). This won't be fixable w/o making img elements be form controls so that we can check if the image belongs to a particular form or not...
Comment 9•22 years ago
|
||
This is especially confusing in cases where <img name="submit"> is not even contained in any <form> element, and yet the user gets an error in the JS Console like Error: document.form1.submit is not a function even though the <img> is not even contained in the form named "form1".
Summary: Javascript works in 4.75 but not in Mozilla build → <img name="submit">, anywhere on page, shadows form.submit()
Comment 10•22 years ago
|
||
Note bug 148248 was marked INVALID: image named 'submit' inside of form shadows the method form.submit() What is the goal in the current bug? Is it this: 1. If <img name="submit"> is inside <form name="form1">, then allow it to shadow form1.submit(). This differs from IE and NN4.7 2. If <img name="submit"> is not inside <form name="form1">, then make sure is does not shadow form1.submit() Is that right?
Reporter | ||
Comment 11•22 years ago
|
||
I have done additional tests and the same page works in Opera on Windows 2000 and iCab on MacOS X. So its just Mozilla that doesn't deal with it.
Comment 12•22 years ago
|
||
*** Bug 159706 has been marked as a duplicate of this bug. ***
Comment 13•22 years ago
|
||
Note: this looks like a duplicate report of bug 148248, "image named 'submit' inside of form shadows the method form.submit()"
Comment 14•22 years ago
|
||
Oops, I missed my own comment #10 above, so let me repeat it: Note bug 148248 was marked INVALID: image named 'submit' inside of form shadows the method form.submit() What is the goal in the current bug? Is it this: 1. If <img name="submit"> is inside <form name="form1">, then allow it to shadow form1.submit(). This differs from IE and NN4.7 2. If <img name="submit"> is not inside <form name="form1">, then make sure is does not shadow form1.submit() Is that right?
Comment 15•22 years ago
|
||
*** Bug 157450 has been marked as a duplicate of this bug. ***
Comment 16•22 years ago
|
||
The code on the offending page has been changed. It is no longer a violation of the ECMA specification. Keep an eye out for regressions I suppose, but as it stands, Sympatico Mozilla users can once again check their email via the web. http://getemail.sympatico.ca/ Someone verify and mark this bug (evanglism) as fixed.
Comment 17•22 years ago
|
||
It seems Sympatico changed the pages again and they don't work again. Now I get a black screen.
Comment 18•22 years ago
|
||
Sorry about the spam, but I found out why it wasn't working for me. I turned off Javascript for a site and forgot to turn it on again. It now works like it used to. Sorry
Reporter | ||
Comment 19•22 years ago
|
||
I confirm that it appears that Sympatico appears to have changed their code and it now appears work with Netscape build (Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0rc2) Gecko/20020512 Netscape/7.0b1), though I can't check with the latest Mozilla 1.1 beta since gecko appears to have some page rendering issues.
Comment 20•22 years ago
|
||
*** Bug 173777 has been marked as a duplicate of this bug. ***
Comment 21•22 years ago
|
||
See bug 173777 Comment 3 for the details of that bug's HTML. There, we have an example of case 2 in Comment #14 above: 2. If <img name="submit"> is not inside <form name="form1">, then make sure is does not shadow form1.submit()
Comment 22•22 years ago
|
||
In my attempt to convert a friend from IE to Mozilla, I stumbled onto this bug. He reported that Mozilla did not work with ChangeSynergy 4.1 from Telelogic (http://www.telelogic.com/products/synergy/changesynergy/index.cfm), and after some investigation I encountered an img named "submit". So, comment #16 ("Someone verify and mark this bug (evanglism) as fixed") is incorrect, as this problem really does expose a Mozilla bug.
Comment 23•22 years ago
|
||
*** Bug 168767 has been marked as a duplicate of this bug. ***
Updated•22 years ago
|
Target Milestone: mozilla1.1alpha → ---
Comment 25•21 years ago
|
||
*** Bug 202395 has been marked as a duplicate of this bug. ***
Comment 27•21 years ago
|
||
I can confirm that this bug still exists with 1.4a. Any news on this bug ? It prevents me and my collegues from using mozilla at work.
Comment 28•21 years ago
|
||
This specifically rules out anything named 'submit' from being reflected as form.submit.
Updated•21 years ago
|
Attachment #121884 -
Flags: superreview?(peterv)
Attachment #121884 -
Flags: review?(caillon)
Updated•21 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla1.4beta
Updated•21 years ago
|
Attachment #121884 -
Flags: superreview?(peterv) → superreview+
Comment 29•21 years ago
|
||
Comment on attachment 121884 [details] [diff] [review] Don't ever resolve form.submit to anything other than HTMLFormElement.submit r=caillon if you promise to not delete parent this time! :-)
Attachment #121884 -
Flags: review?(caillon) → review+
Comment 30•21 years ago
|
||
Comment on attachment 121884 [details] [diff] [review] Don't ever resolve form.submit to anything other than HTMLFormElement.submit This is a trivial patch that fixes problems that pop up here n' there on the web. This makes more sites work, and I can't see how this could break any sites, since those sites wouldn't work in IE either. I see no reason not to take this for 1.4b.
Attachment #121884 -
Flags: approval1.4b?
Comment 31•21 years ago
|
||
Comment on attachment 121884 [details] [diff] [review] Don't ever resolve form.submit to anything other than HTMLFormElement.submit a=sspitzer
Attachment #121884 -
Flags: approval1.4b? → approval1.4b+
Comment 32•21 years ago
|
||
Fix checked in. FIXED.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 33•21 years ago
|
||
Hi, I reported Bug 173777 (duplicate of this bug) As a fix was checked in I tried a nightly (ID:2003042808) on Win2K. The problem does not seem to solved ! While accessing a ChangeSynergy web interface i still got the same errors and could not access the page. javascript errors: Error: window.document.pt_form_load.submit is not a function Source File: http://ccmweb.natlab.research.philips.com:8603/servlet/com.continuus.webpt.servlet.PTweb?token=3953443433632716384&ACTION_FLAG=main_buttonbar_form&TEMPLATE_FLAG=ButtonBar&role=User Line: 563 See attachment of bug 173777 for the sources of the page that gives errors.
Comment 34•21 years ago
|
||
Try a newer nightly, I doubt that one has the fix yet.
Comment 35•21 years ago
|
||
> I tried a nightly (ID:2003042808)
That's 8 in the morning on Apr 28, 2003.
The comment about the fix being checked in was made at 12:28 in the afternoon of
the same day. Hence there is no way for the build you were using to have the fix.
Comment 36•21 years ago
|
||
I'll try again tomorrow. Note: I downloaded the nightly about 10 hours _after_ the 'fixed' comment was made (comment #32). Seems the 'nightly'-link at www.mozilla.org does not really point to the _latest_ nightlies..., right ?
Comment 37•21 years ago
|
||
It does. There are actually two builds a day -- morning and evening. The evening ones start building around 10pm, usually. A build takes 1 hour on a really fast machine; 2 hours on a more reasonable one. You do the math. ;)
Comment 38•21 years ago
|
||
Ok, retried with 2003043008 (Win2K) Bug 173777 (duplicate of this bug) is fixed ! I wrongly assumed the nightlies where updated every 2 hours (or as long as a build takes)
Comment 39•21 years ago
|
||
Reopening since this caused bug 204029.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•21 years ago
|
Attachment #121884 -
Attachment is obsolete: true
Attachment #121884 -
Flags: approval1.4b+
Comment 40•21 years ago
|
||
adding comments to this bug (accidently added it to 148782) note: backing out this fix, does not seem to fix bug bug 204029 at all. (I can't download the actual covers on http://www.cdcovers.cc/dvd_i.php. tried with 1.4b/W2K) note2: IE seems to handle both the site mentioned in bug 204029 as well as sites hit by this bug. So the 2 things don't seem to be mutual exclusive....
Comment 41•21 years ago
|
||
> So the 2 things don't seem to be mutual exclusive
They are mutually exclusive in any compliant ECMAScript implementation (an
object is either a function or not; it cannot be both). This is one of the
known ECMA-compliance bugs in IE, unfortunately.
Comment 42•21 years ago
|
||
Does this mean that the specific case of Bug 173777 is not fixable ? Bug 173777 is marked as a duplicate of this bug bug it seems (from Comment 10) that his bug covers more.
It seems the URL no longer has the problem, can someone with real account verify? Is this bug fixed, or did they just change the website?
Reporter | ||
Comment 44•21 years ago
|
||
They changed the page and it works now. I had notified Sympatico some time back, and it has been fixed on their web site for a while. As part of this bug I would like to suggest two things a) we find a site with the same problem as the original , and list it here, and b) document the on mozilla site how to correct common JS errors that prevent the page correctly working with browsers other than IE.
Comment 45•21 years ago
|
||
This is still an issue - you can see the problem at http://www.gramophone.co.uk/cdreviews.asp
Reporter | ||
Comment 46•21 years ago
|
||
I have resolved to e-mailing web sites that have this issue, and submitting Sympatico's Get E-mail page as an example of how to do things right, since Sympatico has now corrected this issue. The URL which I submit is http://getemail.sympatico.ca
Comment 47•21 years ago
|
||
This bug seems to describe 2 different cases (comment #10) The 2nd case as mentioned in comment 21 isn't unfixable, right ? if IE can do it, opera can do it, netscape 4.x can do it. Mozilla should be able too :) (bug 173777)
Comment 48•21 years ago
|
||
Can someone create a testcase for item 2 in comment 10, please? That should be a non-issue assuming the <form> is actually being closed....
Comment 49•21 years ago
|
||
I attached a testcase to bug 173777. (duplicate of this bug) According to comment #21 that attachement is a testcase of item 2 in comment 10.
Comment 50•21 years ago
|
||
That's not a testcase. That's a huge HTML page with multiple frames and lots of javascript... A testcase is something _small_. This testcase does show the problem, though; looking into it.
Comment 51•21 years ago
|
||
Comment 52•21 years ago
|
||
Comment 53•21 years ago
|
||
Comment on attachment 127694 [details] [diff] [review] Proposed patch So the short story is that the check in nsHTMLDocument is bogus. Note that this patch does not fix the first testcase I attached; unfortunately, the empty-forms-inside-tables hack makes it nontrivial (if possible) to fix it without breaking pages right and left.
Attachment #127694 -
Flags: superreview?(jst)
Attachment #127694 -
Flags: review?(caillon)
Comment 54•21 years ago
|
||
Comment on attachment 127694 [details] [diff] [review] Proposed patch /me thinks this is the wrong patch :-)
Updated•21 years ago
|
Attachment #127694 -
Flags: superreview?(jst)
Attachment #127694 -
Flags: review?(caillon)
Comment 55•21 years ago
|
||
Pay no attention to the man behind the mixed-up patched curtain.
Attachment #127694 -
Attachment is obsolete: true
Updated•21 years ago
|
Attachment #127704 -
Flags: superreview?(jst)
Attachment #127704 -
Flags: review?(caillon)
Comment 56•21 years ago
|
||
Comment on attachment 127704 [details] [diff] [review] Real proposed patch > >+/* static */ PRBool >+nsContentUtils::BelongsInForm(nsIDOMHTMLFormElement *aForm, >+ nsIContent *aContent) >+{ ... >+ if (form == aContent) { >+ // The list for aForm contains the form itself, forms should not No run-on statements please? >+ // be reachable by name in the form namespace, so we return false >+ // here. >+ >+ return PR_FALSE; >+ } >+ .... >+ PRInt32 count = 0; >+ >+ form->ChildCount(count); >+ >+ if (!count) { >+ // The form is a leaf and aContent wasn't inside any other form so >+ // we return true >+ >+ return PR_TRUE; >+ } >+ >+ // The form is a container but aContent wasn't inside the form, >+ // return false >+ >+ return PR_FALSE; return (count != 0); >Index: content/html/document/src/nsHTMLDocument.cpp >=================================================================== >RCS file: /cvsroot/mozilla/content/html/document/src/nsHTMLDocument.cpp,v >retrieving revision 3.498 >diff -p -u -1 -0 -r3.498 nsHTMLDocument.cpp >--- content/html/document/src/nsHTMLDocument.cpp 11 Jul 2003 21:14:57 -0000 3.498 >+++ content/html/document/src/nsHTMLDocument.cpp 14 Jul 2003 04:54:57 -0000 >@@ -3747,41 +3747,32 @@ nsHTMLDocument::ResolveName(const nsAStr > // PR_FALSE to FindNamedItems(). > FindNamedItems(aName, mRootContent, *entry, PR_FALSE); > } > } > > PRUint32 length; > list->GetLength(&length); > > if (length) { > if (length == 1) { >- // Onle one element in the list, return the list in stead of >+ // Only one element in the list, return the element instead of > // returning the list > ... > > return NS_OK; > } > > if (length > 1) { > // The list contains more than one element, return the whole length here will always be > 1. Wanna fix that? r=caillon
Attachment #127704 -
Flags: review?(caillon) → review+
Comment 57•21 years ago
|
||
Comment on attachment 127704 [details] [diff] [review] Real proposed patch +/* static */ PRBool +nsContentUtils::BelongsInForm(nsIDOMHTMLFormElement *aForm, + nsIContent *aContent) Make that comment a C++ style comment. Do you think it would be worth checking if aContent is before aForm in the tree, or after or in the next form (if any, which would mean it either belongs to that form, or doesn't belong to a form at all)? Should be fairly easy to do with nsIDOM3Node::ComareDocumentPosition(). sr=jst
Attachment #127704 -
Flags: superreview?(jst) → superreview+
Comment 58•21 years ago
|
||
Attachment #127704 -
Attachment is obsolete: true
Updated•21 years ago
|
Attachment #127760 -
Flags: superreview?(jst)
Attachment #127760 -
Flags: review?(caillon)
Comment 59•21 years ago
|
||
Comment on attachment 127760 [details] [diff] [review] Now with CompareDocumentPosition! >- if (len < 2) { >- // After t nsFormContentList is done filtering there's zero >- // or one element in the list, return that element, or null >- // if there's no element in the list. >+ if (len < 2) { >+ // After t nsFormContentList is done filtering there's zero Sorry to pile a nit on top of another nit of things that aren't your fault... but while you're here, could you remove the |t| above? >+ // or one element in the list, return that element, or null >+ // if there's no element in the list. > >- nsCOMPtr<nsIDOMNode> node; >+ nsCOMPtr<nsIDOMNode> node; > >- fc_list->Item(0, getter_AddRefs(node)); >+ fc_list->Item(0, getter_AddRefs(node)); > >- *aResult = node; >- NS_IF_ADDREF(*aResult); >+ *aResult = node; >+ NS_IF_ADDREF(*aResult); And NS_IF_ADDREF(*aResult = node); since you're touching this as well... r=caillon
Attachment #127760 -
Flags: review?(caillon) → review+
Comment 60•21 years ago
|
||
Comment on attachment 127760 [details] [diff] [review] Now with CompareDocumentPosition! sr=jst
Attachment #127760 -
Flags: superreview?(jst) → superreview+
Comment 61•21 years ago
|
||
Checked in.
Status: REOPENED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → FIXED
Comment 62•21 years ago
|
||
(Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030715) I can comment that bug 173777 (dup of this bug) is indeed solved with this fix. ChangeSynergy (web-based PR tool from Telelogic) works OK now with the nightly. This shoud be item 2 in comment 10. Thanks.
Comment 63•21 years ago
|
||
Yep, item two in comment 10 is what I was aiming to fix. Thanks for the confirmation!
Comment 64•21 years ago
|
||
This is still a problem at http://www.gramophone.co.uk/cdreviews.asp , with both 1.5 alpha and nightly build 1.5.0.2003081204.
Comment 65•21 years ago
|
||
No, that page shows item 1 from comment 10, as far as I can tell. In any case, that page badly misnests forms and tables, leading to the parser having to mangle things a lot to get something renderable. That's the one case when we could indeed continue having this bug, but there isn't much we can do about it short of changing how the parser handles this situation (not likely).
Comment 66•21 years ago
|
||
*** Bug 218378 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.
Description
•