Thanks for all the useful feedback, I could've sworn I've done this a 100 times ( the $$(els).clone() stuff) in v1.2 but I guess I'm mistaken.
I can now see it's by design, but just as an end user I would think that all Element methods would perform exactly as they do on single elements, but via $$ on collections (inject, setStyle, getCoordinates, etc) - is this not the case? Does $$ only work the same with *specific* methods? I always thought $$ gave me a HTMLCollection rather than a generic Array...sounds like thats an invalid assumption. Thanks very much for the replies, very helpful! On Feb 28, 3:26 am, Arian Stolwijk <[email protected]> wrote: > This is by design, so it's not a bug. > > For some methods like clone, append, contains on Array take precedence over > methods with the same name on Element. > > You can easily solve this by using: > > var cloned = $$('div').map(function(el){ > return el.clone(); > > }); > > If it would be the other way around, it would be harder. > > > > > > > > On Tue, Feb 28, 2012 at 9:00 AM, Aaron Newton <[email protected]> wrote: > > this doesn't clone the elements but rather creates two sets. If you did > > this with elements from a selector, you'd need to invoke .clone on each > > element ($$('div').invoke('clone')) > > > On Mon, Feb 27, 2012 at 11:50 PM, Sanford Whiteman > > <[email protected]>wrote: > > >> > Am I missing something totally obvious? > > >> (In the middle of responding when Aaron's came in, so I figure I'll > >> post anyway.) > > >> Kinda. You only have three elements -- you never cloned the elements. > >> The arrays each contain references to those same three elements. Clone > >> the els (following your own pattern): > > >> http://jsfiddle.net/D4qNB/3/ > > >> -- S.
