Kornel Lesinski wrote:
On Tue, 06 Sep 2005 00:54:56 +0100, Ian Hickson <[EMAIL PROTECTED]> 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/

Reply via email to