(Sorry for the endless spam of fixes to this. :( )

--- element.className = cls.replace(className, "");
+++ element.className = cls.replace(className, " ");

 - Aaron

On Feb 18, 6:57 am, "Aaron Faanes" <[EMAIL PROTECTED]> wrote:
> or, rather, for (removing foo in an element with "foo foobar")
>
>     /** @id MochiKit.DOM.removeElementClass */
>     removeElementClass: function (element, className) {
>         element = MochiKit.DOM.getElement(element);
>         className = " " + className + " ";
>         var cls = " " + element.className + " " || "";
>         element.className = cls.replace(className, "");
>         // Returns true if a change was made, false otherwise.
>         return cls.length > 0 && cls !== element.className;
>     },
>
> On Feb 18, 3:57 am, "Aaron Faanes" <[EMAIL PROTECTED]> wrote:
>
> > A much cleaner removeElementClass?
>
> > /** @id MochiKit.DOM.removeElementClass */
> >     removeElementClass: function (element, className) {
> >         element = MochiKit.DOM.getElement(element);
> >         var cls = element.className || "";
> >         element.className = cls.replace(className, "");
> >         // Returns true if a change was made, false otherwise.
> >         return cls.length > 0 && cls !== element.className;
> >     },
>
> >  - Aaron


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to