Or with my version:
Element.Implement({
'removeClassesExcept': function(baseClass){
this.set('class', this.get('class').split('
').filter(function(c){return c == this },baseClass)[0]);
}
})
On Mon, Feb 15, 2010 at 8:55 PM, Sanford Whiteman <
[email protected]> wrote:
> > Yes, But the question was from an array of controls:
>
> When you implement on Element, you automatically implement on Elements
> arrays. There is no need to implement on the generic Array.
>
> Element.implement({
> removeClassesExcept: function(klass) {
> ...
> }
> });
>
> $('remove').addEvent('click', function() {
> $$('li').removeClassesExcept('base_class'); // works
> });
>
> -- S.
>
>
--
---
"Make everything as simple as possible, but not simpler."
- Albert Einstein