- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Tue, 06 Sep 2005 20:15:25 +1000
Kornel Lesinski wrote:
> On Tue, 06 Sep 2005 00:54:56 +0100, Ian Hickson <ian at hixie.ch> wrote:
>> You can just do:
>>
>> if (x) find.push("class1");
>> if (y) find.push("class2");
>> document.getElementsByClassName.apply(document, find);
>>
>> ...which seems much better to me than using a string.
>
> It's the first time I see apply method used. I couldn't find it in
> ECMA262-3 nor in WA1.0. Can you give me a hint where it's defined?
> Why is that better than using string?
It's a method of Function().
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Function:apply
--
Lachlan Hunt
http://lachy.id.au/
Received on Tuesday, 6 September 2005 03:15:25 UTC