Closed
Bug 209453
Opened 22 years ago
Closed 22 years ago
document.forms.length=0 if the script is before a FORM
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
VERIFIED
INVALID
People
(Reporter: dcl441-bugs, Assigned: rogerl)
References
()
Details
Attachments
(1 file)
243 bytes,
text/html
|
Details |
Mozilla Firebird 2003061308
There are some pages (see URL) that fail to count the number of forms because
the JavaScript is in the HEAD tag, obviously before any FORM tag.
I attach a simpler testcase.
Reporter | ||
Comment 1•22 years ago
|
||
Comment 2•22 years ago
|
||
This seems like the proper behaviour: if the page hasn't finished loading then
Mozilla can't guess how many forms will be in the page, it only knows how many
forms have been created so far.
IE 5.5 shows the same behaviour. Does this example work like you want it to do
in any browser at all?
![]() |
||
Comment 3•22 years ago
|
||
This is invalid. The behavior here is the same in all browsers -- the script
executes when the <script> tag is processed, which is before anything else has
been parsed (this is the only way document.write() can work reasonably).
If you need to make sure the script only runs when the DOM is complete, run it
off the onload event.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 5•22 years ago
|
||
OK.
The URL doesn't work due to this, I suppose it's webmaster's fault then.
(see bug 113140 comment 6)
![]() |
||
Comment 6•22 years ago
|
||
Yes. Which is why the bug is Tech Evang....
You need to log in
before you can comment on or make changes to this bug.
Description
•