Argumentative

R

RobB

Can anyone explain this behavior, in moz/gecko?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
<script type="text/javascript">

document.write(
'<pre>',
foo,
'\n\n',
'foo(\'one\')\n',
'foo(\'one\',\'two\')\n',
'timerID = setTimeout(foo, 1000)'
);

var timerID = null;
function foo()
{
var args = [];
for (a = 0; a < arguments.length; ++a)
args.push('arguments[' + a + '] = ' + arguments[a]);
if (timerID) args.push('timerID: ' + timerID);
alert('arguments.length = ' + arguments.length + '\n\n' +
args.join('\n'));
}

foo('one');
foo('one', 'two');
timerID = setTimeout(foo, 1000);
</script>
</body>
</html>
 
M

Martin Honnen

RobB said:
Can anyone explain this behavior, in moz/gecko?
var timerID = null;
function foo()
{
var args = [];
for (a = 0; a < arguments.length; ++a)
args.push('arguments[' + a + '] = ' + arguments[a]);
if (timerID) args.push('timerID: ' + timerID);
alert('arguments.length = ' + arguments.length + '\n\n' +
args.join('\n'));
}
timerID = setTimeout(foo, 1000);

That is a known issue that there is a parameter passed to the function, see
<https://bugzilla.mozilla.org/show_bug.cgi?id=263945>
I don't think it is regarded a bug by anyone who could fix it.
 
R

RobB

Martin said:
RobB said:
Can anyone explain this behavior, in moz/gecko?
var timerID = null;
function foo()
{
var args = [];
for (a = 0; a < arguments.length; ++a)
args.push('arguments[' + a + '] = ' + arguments[a]);
if (timerID) args.push('timerID: ' + timerID);
alert('arguments.length = ' + arguments.length + '\n\n' +
args.join('\n'));
}
timerID = setTimeout(foo, 1000);

That is a known issue that there is a parameter passed to the function, see
<https://bugzilla.mozilla.org/show_bug.cgi?id=263945>
I don't think it is regarded a bug by anyone who could fix it.

Thanks Martin ! Interesting comments, particularly the ultimate one
from Brendan Eich. The 'phantom' parameter was invalidating an attempt
to determine whether the call was the original one (with arguments).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top