document.getElementsByTagName("*") returns incorrect number of elements.

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
15 years ago
11 years ago

People

(Reporter: mno2go, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007

Here is some code that I used to test this on:

<div id="div1">Test</div>
<div id="div6">Test</div>
<div id="div5">Test</div>
<div id="div4">Test</div>
<div id="div3">Test</div>
<div id="div2">Test</div>

I've trimmed all the other standard HTML page elements. When running the
following JavaScript:

var allel = document.getElementsByTagName("*");
alert (allel.length);

I was returned 5 elements in the popup. There are 6 divs. IE 6 handles this
correctly.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

Comment 1

15 years ago
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040125

I got 10 from this code:
html, head, body, script, 6:divs

I'm not sure why you did this... if i replace * w/ div then i get 6 as expected...
Assignee: general → general
Severity: major → normal
Component: JavaScript Engine → DOM: Core
QA Contact: pschwartau → ian

Comment 2

15 years ago
Max could you please re-test your code in the latest builds? The code you posted
in the URL returns 10 (correctly), and if I write a html file only with the 6
divs then do a javascript:url with 
javascript:alert(document.getElementsByTagName("*").length)
then I get 9 (correctly).
(Reporter)

Comment 3

15 years ago
It seems to be working properly now. I don't know what caused the issue back
when I reported it.

Comment 4

15 years ago
Thanks for the followup, Max. Marking worksforme per the reporter's comments.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 5

15 years ago
Anytime. It might have been fixed along the way. I just tested the code on the
original build on a different computer, and I saw the bug. :)

Updated

11 years ago
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.