Closed Bug 242557 Opened 20 years ago Closed 8 years ago

If I have a hidden field and it is accessed in a event of a tag <a href ...> it fails

Categories

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

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jc104, Assigned: jst)

References

()

Details

(Keywords: regression, Whiteboard: regression from bug 147058)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040421
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040421

for example I have the next variable 
<form name="form1" method="post" action="main.jsp">
<input name="hago" type="hidden" value="">
if I do the next item variable
<input type="button" name="Button"  value="<<" class="inputButton"
onClick="hago.value='<<'; submit();">

and its work fine but if i have the next
<a href="#" onClick="hago.value='load'; submit();"> << </a>

this do not work and i see the javascript console and report hago is undefined

Reproducible: Always
Steps to Reproduce:
1.declare a input hidden
2.uses this input hidden in an event of a tag <a href>
3.

Actual Results:  
the page does not do nothing the  java script console shows that the field is
undefined

Expected Results:  
perform then event onclick
Nothing to do with form submission.  jst, this sounds like that scope chain
thing that we removed... did we hack in something for inputs?
Assignee: form-submission → general
Component: HTML: Form Submission → DOM: Level 0
QA Contact: ian
Hmm, yeah... Form controls have their form as their JS parent, other nodes have
the document as their JS parent, thus form controls will only appear in the
scope of forms or form controls, not links. I wonder if IE special cases links
here, or if anything in a form gets the form as its JS parent?

We could make the code that finds the JS parent look up the parent chain for an
HTML form element, and if it finds one, use it. But that could hurt performance
if we do it across the board... Thoughts?
Juan, if you replace the <a> with a <div> in IE (and leave the onclick handler
on the div), what happens?
In IE it works equals with the tag <div> as the tag <a>, I update the test page 
in the url there is the test with <a> with <div> and with <input type button>
What is window.xjc in IE?
xjc is the name of the hidden field, if you see the source code there is, the 
form is named "jc" and the input hidden is named "xjc"
Yes, I know it's the name.  That doesn't answer my question.  What does
"window.xjc" evaluate to in IE on that document, especially when evaluated from
script that is not a child of the form?
*** Bug 247745 has been marked as a duplicate of this bug. ***
So how much would it really hurt to look for a form?  We used to do it, no? 
Before bug 147058 landed?
Keywords: regression
Shouldn't be too bad if we do it only for links...
I'd say let's just do links.
Blocks: 251494
Well, doing just links won't help bug 253267 and bug 253091.

I'm marking this confirmed; whatever's going on we're breaking a sites that used
to work and that work with IE.....
Blocks: 253091, 253267
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: regression from bug 147058
In this DOM level 0 territory, it seems to me we have to do what IE did. 
Netscape 4 is too old, and it lacked onclick for divs and such.

How hard can it be?

/be
Brendan, as I understand it bug 147058 was fixed to give us IE compat on a
different set of testcases....

So apparently, it's hard. Step one is to figure out what it is IE is doing.
*** Bug 254418 has been marked as a duplicate of this bug. ***
This bug and its dependancies should be retested now that bug 256932 has been
fixed.  Chances are, a lot of the testcases suddenly work now...
Keywords: qawanted
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a5) Gecko/20041024

I don't see any improvements for any of the dependant bugs. :(
Depends on: 264247
Indeed....  See bug 264247 comment 6.  In short, the fix for bug 256932 doesn't
apply to inputs.
Could we decide something here one way or another and maybe implement it in 1.9?
The most logical thing (and therefor easiest to understand) is probably to make
everything inside a form use the form as the parent. This way peoples stuff
won't break just because they change a tagname from <a> to <div>.

Of course, there is the issue of performance. Walking up the parent chain is
pretty cheap these days though since nsIContent::GetParent is non-virtual and
inline.
*** Bug 312523 has been marked as a duplicate of this bug. ***
Flags: blocking1.9a1?
Flags: blocking1.9a1? → blocking1.9+
Summary: If I have a hidden field and it is accesed in a event of a tag <a href ...> it fails → If I have a hidden field and it is accessed in a event of a tag <a href ...> it fails
This isn't really blocking, but it'd be nice to fix. Jst thinks the perf hit wouldn't be too bad, but the problem might be that none of our tests would see it. Though dHTML might catch it.
Assignee: general → jst
Flags: blocking1.9+ → blocking1.9-
Whiteboard: regression from bug 147058 → regression from bug 147058 [wanted-1.9]
window.xjc in IE is null. Looks like IE really is just putting the <form> element into the scope chain of anything with a <form> descendant. That's annoying.
Flags: wanted1.9+
Whiteboard: regression from bug 147058 [wanted-1.9] → regression from bug 147058
QA Contact: ian → general
Dropping qawanted based on comments 17, 18.
Keywords: qawanted
Cannot reproduce
Version 	50.0a1
Build ID 	20160715063552
User Agent 	Mozilla/5.0 (Windows NT 5.1; rv:50.0) Gecko/20100101 Firefox/50.0
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.