Closed Bug 400342 Opened 18 years ago Closed 16 years ago

for (node in nodes) changes the nodes

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: ole.ersoy, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070417 Fedora/2.0.0.3-4.fc7 Firefox/2.0.0.3 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070417 Fedora/2.0.0.3-4.fc7 Firefox/2.0.0.3 This alert never gets triggered and there are 3 nodes in nodeArray: for (node in nodeArray) { if (node == nodeArray[1]) {alert("match")} } It seems like the nodes in the node array are changed by using a for in loop. I caught this by looking for a type one node in the array. I know that nodeArray[1] is an instance of a type 1 node. However, when I look for it like this: if (node.nodeType == 1) ... it is never found. If I do an alert for node.nodeType for each iteration of the loop, all of the messages say "undefined". Before doing this I tested that nodeArray[1].nodeType == 1, so I was expecting the second alert to say "1". Reproducible: Always Steps to Reproduce: Just create an array of dom nodes with 2 or more nodes and try this: for (node in nodeArray) { if (node == nodeArray[1]) {alert("match")} } The alert will never be triggered. Also the type of the nodes will not be "undefined", even if they are type 1 nodes. Actual Results: See steps to reproduce Expected Results: See steps to reproduce
Can you attach a file (HTML with script) that demonstrates the bug?
No response from reporter.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.