As always the answer comes down to how many elements are affected, usually with "addClass" and alike actions it will take you usually longer to run the selector that finds your element, than actually setting the element's "class" attribute. The clear winner in performance is obviously the one that doesnt do any concatenations (setClass), but this is really minimal, the general rule is, if you think you will need the extra functionality dont worry about the performance, do optimizations later if needed!
On Wed, Nov 25, 2009 at 3:07 PM, stratboy <[email protected]> wrote: > I already said that. Anyone can answer the real question? > > On 25 Nov, 11:59, אריה גלזר <[email protected]> wrote: > > aside from the faster question, i would think that addClass is better for > it > > allows extra behavioral functionality (for example adding instead of > setting > > etc.) > > ----------- > > אריה גלזר > > 052-5348-561 > > 5561 > > > > On Wed, Nov 25, 2009 at 12:27, stratboy <[email protected]> wrote: > > > elem.set('class','rco-topleft') > > > > > elem.addClass('class','rco-topleft') > > > > > what's the faster/better? > > > > > Yes, i know, addClass can add a class, class='class1 class2 rco- > > > topleft', so it's different. But still the questions, in that case. > -- --- "Make everything as simple as possible, but not simpler." - Albert Einstein
