Appending new text nodes that include undefined on a setInterval create random numbers unexpectedly

RESOLVED DUPLICATE of bug 394769

Status

()

RESOLVED DUPLICATE of bug 394769
9 years ago
9 years ago

People

(Reporter: delan.azabani, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a4pre) Gecko/20100403 Ubuntu/10.04 (lucid) Minefield/3.7a4pre
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a4pre) Gecko/20100403 Ubuntu/10.04 (lucid) Minefield/3.7a4pre

When creating and appending a text node to the body of a page within a repeated setInterval, using an un-passed argument (which should evaluate to undefined), the text node contains random numbers, mostly zero, instead of undefined. Opera and Chrome do not show this behaviour.

Reproducible: Always

Steps to Reproduce:
1. Create a setInterval call
2. Make the function have an expected argument defined
3. Add a createTextNode/appendChild call including that argument
Actual Results:  
Random integers are written over the screen, mostly zero.

Expected Results:  
The word undefined should be written repeatedly over the screen.

This is the offending code:

setInterval(function(t) {
  document.body.appendChild(document.createTextNode(t + ' '));
}, 0);

More details at my blog post: http://azabani.com/45

Comment 1

9 years ago
It's not exactly random, see https://developer.mozilla.org/en/DOM/window.setInterval#Callback_arguments

This is tracked in bug 394769.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 394769
You need to log in before you can comment on or make changes to this bug.