Back
[Rails] Bugfix for removeClassName in prototype.js 1.4.0_rc2
Other·Calvin Correli·Nov 22, 2005· 1 minutes

Not sure where the tracker for Prototype is, so I’m posting it here, in case fellow railers run into it—1.4.0_rc2 is the version distributed with the latest Rails.

Element.removeClassName will leave the classnames with commas instead of space between classes. Fortunately, the fix is easy:

Index: public/javascripts/prototype.js
===================================================================
--- public/javascripts/prototype.js     (revision 450)
+++ public/javascripts/prototype.js     (working copy)
@@ -1079,7 +1079,7 @@
     if (!this.include(classNameToRemove)) return;
     this.set(this.select(function(className) {
       return className != classNameToRemove;
-    }));
+    }).join(' '));
   },

   toString: function() {