Closed Bug 22795 Opened 25 years ago Closed 24 years ago

form not in default namespace of form controls

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: pabloa, Assigned: jst)

References

()

Details

Attachments

(2 files)

Overview Description:
A check box event isn't running.

Steps to Reproduce:
1) go to this URL
2) click in checkbox 'Mostrar mensajes ampliados'


Actual Results:
Nothing
The debug window shows:

'JavaScript Error: ReferenceError: frmVerForos is not defined'



Expected Results:
It must to jump to:

http://www.patagon.com.ar/forlf.asp?pI=1&cI=20&fId=2&i=2&tP=1835&a=false&b=&t=1&
o=nroMensajeIdioma&s=DESC


Build Date & Platform Bug Found:
1999122808

Additional Information:
I tested with Communicator 4.77 and IE5 and this checkbox work fine.
Assignee: mccabe → karnaze
Component: Javascript Engine → HTML Form Controls
In the future, a reduced testcase would be GREATLY appreciated.  In addition,
see http://www.mozilla.org/js/tests/library.html#PLEASE for a description of
what the JavaScript Engine component actually covers.

  The page relies on an obscure misfeature in 4x browsers.  The onClick handler
in question attempts to execute javascript:frmVerForos.submit(); in the line:

<input type=checkbox value=1 name=t  onClick="javascript:frmVerForos.submit();">

  This should (at least) be "document.frmVerForos.submit();", and ideally
"document.forms.frmVerForos.submit();".  The only reason this works in 4x
browsers is because the <input> tag is inside a <form> tag.  If you were to
specify the <input> tag outside of any <form>, you would get the same JavaScript
error in 4x.

  The author of the page has also prefixed the onclick code with a redundant
"javascript:" (an onclick attribute is javascript code by default), but
apparently the browsers are smart enough to ignore it.

  Surely this isn't the only page out there which make use of the 'feature'.
Attaching a reduced testcase and reassigning to HTML Form Controls.
Attached file reduced testcase
Steps to reproduce:
Load the testcase and click on the checkbox.

Expected (works in 4x):
Alert dialog containing the text:
function submit() {
  [native code]
}

Actual:
JavaScript Error: ReferenceError: form1 is not defined
Assignee: karnaze → pollmann
Reassigning to Eric.
*** Bug 22705 has been marked as a duplicate of this bug. ***
Assignee: pollmann → vidur
Component: HTML Form Controls → DOM Level 0
OS: Windows 95 → All
Hardware: PC → All
Summary: javascript event checkbox error → form not in default namespace of form controls
Vidur, wasn't this bug fixed last millenium?  (bug 15133 and bug 15185)  I'm not
too familiar with this area, can you take a look at this bug?

If this bug is blocking anyone, one workaround is to prepend document. to the
form name:

<HTML>
 <BODY>
  <FORM NAME="form1">
   <INPUT TYPE="button" VALUE="Shorthand" ONCLICK="alert(form1.submit)">
   <INPUT TYPE="button" VALUE="Standard" ONCLICK="alert(document.form1.submit)"
  </FORM>
 </BODY>
</HTML>
Assignee: vidur → brendan
Checked in a temporary fix on 1/5/2000. The problem was introduced by code in
nsJSContext::CompileEventHandler that unconditionally broke the scope link of
compiled event handlers. While this is correct in the brutal sharing case, it
shouldn't be done for HTML. Keeping the bug alive and passing it along to
Brendan for a cleaner fix.
Status: NEW → ASSIGNED
Target Milestone: M13
I think a flag argument to nsIScriptContext::CompileEventHandler is cleanest.
Should be easy, once I update my tree from last year!

/be
Cc'ing brutal sharers.

This is P3 priority, but I'll fix it sooner anyway just to get it done right.

/be
Crap, this is my fault.  I recall talking to Waterson about HTML, but apparently
I didn't do the right thing in the end.  Sorry, and thanks to brendan for wiping
my chin.
FYI re: rginda's comments:

1.  This scope nesting (event handler in event target in form in document in
window) is not a misfeature, or particularly obscure.  Brevity in event handlers
written as attribute values is a virtue!

2.  The redundant (or just plain wrong) javascript: at the front of the original
test case's event handler attribute value is not ignored by any browser smarts
-- it's a valid JS statement label.

/be
Thank you sir, may I have another!
Seeking vidur re-review.

/be
Brendan's patch fixes the testcase on my linux build.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
The cleaner fix vidur and I like better is now in.

/be
Guys: similar bug exists on http://tvguide.netscape.com/listings

The submit() code doesn't update the pull down JS box (broadcast, cable, 
satellite).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Uh, this is not the bug that was once on my list, and that I closed.

But since this bug got revived after death, instead of a new one being filed, 
I'll let jst have it (or better, make a new one).

/be
Assignee: brendan → jst
Status: REOPENED → NEW
Mass moving old milestone bugs to M16
Target Milestone: M13 → M16
Looks like this is working now, I don't know what fixed it tho, marking
WORKSFORME
Status: NEW → RESOLVED
Closed: 25 years ago24 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: