Mootools extends all Natives! So every String ("boo") has a test() Method.
Like ervery Event hast a Event.stop() or every Element has a Element.set().
That´s the Mootools way, and i like it. ;o)
If you want to test that a Object is a String, a better way would be:

if( Object.isString() ) ....

or simply

if( typeof Object == 'string' ) ...

2010/5/14 Michal Charemza <[email protected]>

> I'm not sure how to completely  address Thomas' issue, but I think the post
> is about code like:
>
> String.test(o);
>
> rather than
>
> "someText".test(o);
>
> which is what is documented at
> http://mootools.net/docs/core/Native/String#String:test .
>
> However, MooTools has the $type method http://mootools.net/docs/core#typethat 
> can be used to determine if something is a String.
>
> Michal.
>
>
> On 14 May 2010, at 18:03, André Fiedler wrote:
>
> Not undocumented:
>
> http://mootools.net/docs/core/Native/String#String:test
>
> 2010/5/14 Thomas Allen <[email protected]>
>
>> Does MooTools provide some undocumented function on String, "test"?
>> I'm not referring to String.prototype.test. I ask because I have my
>> own script which implements String.test(o) to return true if o is a
>> String and false if not, and it fails if I include MooTools on the
>> same page. Specifically, the error is identical to calling
>> "someString".test() with no argument, "TypeError: a is undefined."
>>
>> Actually, it appears that MooTools writes all of its prototype methods
>> to the native constructor, because String.contains exists only with
>> MooTools loaded, etc. That is absurd.
>>
>> Thomas
>>
>
>
>

Reply via email to