Argumentative

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RobB

    #1

    Argumentative

    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.lengt h; ++a)
    args.push('argu ments[' + a + '] = ' + arguments[a]);
    if (timerID) args.push('time rID: ' + timerID);
    alert('argument s.length = ' + arguments.lengt h + '\n\n' +
    args.join('\n') );
    }

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

  • Martin Honnen

    #2
    Re: Argumentative



    RobB wrote:
    [color=blue]
    > Can anyone explain this behavior, in moz/gecko?[/color]
    [color=blue]
    > var timerID = null;
    > function foo()
    > {
    > var args = [];
    > for (a = 0; a < arguments.lengt h; ++a)
    > args.push('argu ments[' + a + '] = ' + arguments[a]);
    > if (timerID) args.push('time rID: ' + timerID);
    > alert('argument s.length = ' + arguments.lengt h + '\n\n' +
    > args.join('\n') );
    > }[/color]
    [color=blue]
    > timerID = setTimeout(foo, 1000);[/color]

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


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • RobB

      #3
      Re: Argumentative

      Martin Honnen wrote:[color=blue]
      > RobB wrote:
      >[color=green]
      > > Can anyone explain this behavior, in moz/gecko?[/color]
      >[color=green]
      > > var timerID = null;
      > > function foo()
      > > {
      > > var args = [];
      > > for (a = 0; a < arguments.lengt h; ++a)
      > > args.push('argu ments[' + a + '] = ' + arguments[a]);
      > > if (timerID) args.push('time rID: ' + timerID);
      > > alert('argument s.length = ' + arguments.lengt h + '\n\n' +
      > > args.join('\n') );
      > > }[/color]
      >[color=green]
      > > timerID = setTimeout(foo, 1000);[/color]
      >
      > That is a known issue that there is a parameter passed to the[/color]
      function, see[color=blue]
      > <https://bugzilla.mozill a.org/show_bug.cgi?id =263945>
      > I don't think it is regarded a bug by anyone who could fix it.
      >
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/[/color]

      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).

      Comment

      Working...