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)

1.8 Branch
x86
Linux
defect
Not set
minor

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
Attached file testcase
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.
Assignee: nobody → general
Component: General → DOM
Keywords: testcase
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.8 Branch
Assignee: general → nobody
QA Contact: ian → general
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: