Closed Bug 270168 Opened 20 years ago Closed 15 years ago

JavaScript can not refer to some type="hidden" input field values

Categories

(Core :: DOM: HTML Parser, defect)

1.7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: hiroto.kagotani+mozilla, Unassigned)

Details

(Whiteboard: [fixed by the HTML5 parser])

Attachments

(4 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a5) Gecko/20041115 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a5) Gecko/20041115 Firefox/0.9.1+

Here is a very simplified but valid HTML code
that doesn't work as expected:

<html>
<head><title>Test</title></head>
<form name="F1"><input type="hidden" name="N1" value="V1"></form>
<p>
<!-- xxxx -->
<script type="text/javascript">
<!--
document.writeln(document.F1.N1.value);
// -->
</script>
yyyy
</p>
</html>

I expect that this code first shows the hidden input field value "V1"
and then "yyyy" in a paragraph.  But JavaScript Console says
"document.F1 has no properties" and I got only "yyyy" in the paragraph.

When I uncomment the xxxx line, the JavaScript works fine and I get
"xxxx V1 yyyy" in the paragraph as I expect.
IE works well for the bose cases.

Reproducible: Always
Steps to Reproduce:
1. save the code above in a .html file.
2. open it locally or via web server.

Actual Results:  
Firefox/Mozilla showed just "yyyy" in the page,
and I got an error "document.F1 has no properties" in the JavaScript Console.

Expected Results:  
They should show "V1 yyyy" in the page,
and I should not get an error.
Blake, this one of yours?  (I did not test)
Attached file script-text testcase
Reporter's original testcase: script, then text. Fails in Firefox 1.0 and in
Seamonkey 2004111606
Script, then text, then the script again. In Firefox 1.0, the second bit of
script succeeds, in Seamonkey 2004111606 both fail.
Attached file text-script testcase
Text, then script: both Firefox and Seamonkey like this.
Works when you add in a body tag. (In reply to comment #2)
> Created an attachment (id=166194)
> script-text testcase

Works if you add in the missing body tag.
D'oh! All that test-casing, I completely failed to notice we were testing the
recovery from a missing <body> - as you say, add the <body> and all three work
fine in both Firefox and Seamonkey. As long as I've already bugspammed mrbkap
with all those attachments, might as well see if it's behaving as intended, but
otherwise I guess it's INVA?
Attached file script-frameset case
Oh, I'm sorry.	I am using a text in the missing body.
How about frameset case?
(In reply to comment #7)
> Created an attachment (id=166291)
> script-frameset case
> 
> Oh, I'm sorry.	I am using a text in the missing body.
> How about frameset case?

Um, that still isn't valid markup. Try validating testcases before submitting them.

Like Phil said, there may still be some underlying issue that this exposes, but
with bad markup this may be resolved as INVALID.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
Assignee: firefox → mrbkap
Component: General → HTML: Parser
Product: Firefox → Core
QA Contact: general → parser
Version: unspecified → 1.7 Branch
Very likely invalid, but this should be tested in a recent build.
Assignee: mrbkap → nobody
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by the HTML5 parser]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: