It's more common to do something like:
var Widget = new Class({
    initialize: function(items) {
        this.items = $$(items);
        this.items.each....
    }
});



On Tue, Oct 7, 2008 at 2:06 PM, Michael Duff <
[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> wrote:

>
> Hey Everyone,
>
> I have a question about coding style, I will be using the same "items"
> over and over throughout a class I am writing, so would it be better
> to place these items in an array for later use?
>
>
> $$('.someclass').each(function(item, index) {
>         this.items[] = item;
> });
>
>
> then anytime I need to loop through them I can just use this.items
> instead of $$, does anyone know if its more expensive to store
> references to those items or for mootools to go find them each time?
>
> Mike
>
>
>
> ------------------------------
>  View message @
> http://n2.nabble.com/cheaper-to-use-array-or-%24%24%28%29-tp1304776p1304776.html
> To start a new topic under MooTools Users, email
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>


-----
The MooTools Tutorial:  http://www.mootorial.com www.mootorial.com 
CNET Clientside:  http://clientside.cnet.com clientside.cnet.com 
-- 
View this message in context: 
http://n2.nabble.com/cheaper-to-use-array-or-%24%24%28%29-tp1304776p1304794.html
Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to