Closed
Bug 371132
Opened 18 years ago
Closed 13 years ago
using getElementsByTagName("script") multiple times before load is complete does not show current list of loaded files
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: m1, Unassigned)
Details
(Keywords: testcase)
Attachments
(2 files)
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1
If using document.getElementsByTagName("script") in a script that is being generated within the <head>, the first time the command is executed, it returns the current list of scripts loaded.
However, for all subsequent calls, the same list is returned as the first time the call was made and this only seems to correct itself once the load is complete (ie by onload, all of the script elements are found)
NOTE this is a simplified example and I believe could be related to a timing issue. I have had examples where this works - especially if using the debugger.
Reproducible: Always
Steps to Reproduce:
1.have a javascript file call document.getElementsByTagName("scripts")
2.have a second JS file do the same thing
Actual Results:
1. Will list all of the scripts included so far, including the current script.
2. Does not show any more scripts - only the previous list of files
Expected Results:
1. Will list all of the scripts included so far, including the current script.
2. Shows newly included files
The easiest workaround is to include the scripts and run the getElementsByTagName once they have been included.
This may affect script.aculo,us and any other libraries that try and dynamically load libraries as the main install script does search the existing scripts.
This contains several included js files, each of which performs a document.getElementsByTagName("scripts") and lists in an alert box the current list.
Note that I have run this test several times and mostly it will not show more than f4 and f1 until the HTML list in the <body> and the onload alert. However I have had experiences whereby the during the load of f3, all of the files are shown. This is however intermittent
Comment 2•18 years ago
|
||
This testcase can be viewed online.
I can see the bug on branch, but not on trunk anymore, so it seems to be fixed by something.
Updated•18 years ago
|
Assignee: nobody → general
Component: General → DOM
Keywords: testcase
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.8 Branch
Comment 3•18 years ago
|
||
So this seems to be fixed between 2006-05-12 and 2006-05-13:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-05-12+05&maxdate=2006-05-13+06&cvsroot=%2Fcvsroot
It seems to me this was fixed by bug 332644. Right, Boris?
Flags: in-testsuite?
Updated•16 years ago
|
Assignee: general → nobody
QA Contact: ian → general
Updated•13 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•