[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: An ECMAScript question
From:       Harri Porten <harri () trolltech ! com>
Date:       2001-04-20 1:22:11
[Download RAW message or body]

Pavel Troller wrote:
> 
> Hi!
>   I'm trying to isolate a problem with a JavaScript. It worked for a long
> time in Konqueror, but then stopped to work and didn't start again yet.
>   I isolated a problematic part to the attached test file.
  
  function JS_test () {
    var i;
    i=JS_test.arguments.length;
  }

The arguments object is something special. It's a property of the
"activation object" which itself should be invisible to the user. Seems
like this special case doesn't work correctly when the arguments object
is addressed via the function object. But I'm also not sure if
JS_test.arguments is still legal in the 3rd edition of the ECMAScript
standard. I read about problem with optimizing this or solving threading
problems (what would be the result if JS_test is called recursively ?
Isn't is just a local object instead of a globally visible property of
the function object ?

>   The problem is that by activating the script, I'm getting
> JS: Type error: Undefined value
>   instead of assigning the real number of arguments (here 5) to the
> variable i. I'm not a JS guru; I downloaded and printed the ECMA-262 doc
> and found that such a construct seems to be valid (and this definitely
> worked formerly and works in Netscape as well).

I fixed some other problems with the arguments object. It had changed
between Edition 1 and 3.

>   How to solve this problem ?

Don't prefix arguments.length with JS_test. That works fine. But I'll
look into this issue and solve it either way.

Harri.
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic