> Function.prototype.foo = function() { alert("hello"); }
> function () { alert("hello"); }
> xxx.foo()
> ReferenceError on line 1: xxx is not defined
> 
> This was executed in a javascript shell (bookmarklet for firefox). "xxx"
> shouldn't be defined. That it works for you, also mean, that "xxx" is
> already defined (maybe from a different area of code).

sorry man, that is not the case.

copy these two line into some js-code of yours. and execute it in a
browser:

    alert("FUNC:" + AVeryLongIdentifierAsAProofForSebastian);
    function AVeryLongIdentifierAsAProofForSebastian(){}

and i assure you: nowhere else in my code there is an identifier named
"AVeryLongIdentifierAsAProofForSebastian".

but you are right on one account. the identifier must be defined. thou
not before its first usage.

interessting.

yozzeff


> 
> Sebastian
> 
> 
> [EMAIL PROTECTED] schrieb:
> 
>> hi,
>>
>> this is a bit off topic - but as there are surely quite a bit
>> javascript gurus around...
>>
>> lets assume i have defined the following method on the Function object.
>>
>>
>> Function.prototype.foo = function(){}
>>
>> now i define a few other functions
>>
>> function xxx(){};
>> function yyy(){};
>>
>> and i call foo on them. sofar no big surprise. foo
>> gets called. i am happy.
>>
>> xxx.foo();
>> yyy.foo();
>>
>> NOW i reverse the order of the foo-calls
>>
>> xxx.foo();
>> yyy.foo();
>>
>> function xxx(){};
>> function yyy(){};
>>
>> that is. i call foo before defining the functions to call
>> them on. the BIG surprise is, that this works as well.
>>
>> tested on ff 1.0.7, ie 6.0 sp2 and ie 7.0beta2
>>
>>
>>
>> yozzeff
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by xPML, a groundbreaking scripting
>> language
>> that extends applications into web and mobile media. Attend the live
>> webcast
>> and join the prime developer group breaking into this new coding
>> territory!
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> _______________________________________________
>> Qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to