form not in default namespace of form controls

RESOLVED WORKSFORME

Status

()

P3
normal
RESOLVED WORKSFORME
19 years ago
18 years ago

People

(Reporter: pabloa, Assigned: jst)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments)

(Reporter)

Description

19 years ago
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.

Updated

19 years ago
Assignee: mccabe → karnaze
Component: Javascript Engine → HTML Form Controls

Comment 1

19 years ago
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.

Comment 2

19 years ago
Created attachment 3936 [details]
reduced testcase

Comment 3

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

Updated

19 years ago
Assignee: karnaze → pollmann

Comment 4

19 years ago
Reassigning to Eric.

Comment 5

19 years ago
*** Bug 22705 has been marked as a duplicate of this bug. ***

Updated

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

Comment 6

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

Updated

19 years ago
Assignee: vidur → brendan

Comment 7

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

Comment 12

19 years ago
Thank you sir, may I have another!
Created attachment 4049 [details] [diff] [review]
cleaner fix to the QI-again-for-event-handler-owner fix
Seeking vidur re-review.

/be

Comment 15

19 years ago
Brendan's patch fixes the testcase on my linux build.
Status: ASSIGNED → RESOLVED
Last Resolved: 19 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

Comment 19

19 years ago
Mass moving old milestone bugs to M16
Target Milestone: M13 → M16
(Assignee)

Comment 20

19 years ago
Looks like this is working now, I don't know what fixed it tho, marking
WORKSFORME
Status: NEW → RESOLVED
Last Resolved: 19 years ago19 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.