calvin-brand-light-mode
calvin-brand-dark-mode
∕
⌘K
About Calvin Podcast We Can Do This Book Speaking
aAbout Calvin
Podcast
wWe Can Do This Book
sSpeaking
Back

[Rails] Bugfix for removeClassName in prototype.js 1.4.0_rc2

Other
Calvin Correli·Nov 22, 2005· 1 minute

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() {
Previous [dk] Kontorartikler
Next Do you know any Jason Frieds?

Comments

Write a comment...
00:00 Recording...
calvin-brand-light-mode
calvin-brand-dark-mode
1 Chestnut Hill Plaza #1139
Newark, DE 19713
United States
Copyright © 2026 Calvin Correli
powered by