Hi, I have just started using prototype.js and scriptaculous.js in one of my projects. These libraries are awesome and they let me do so much more, so easily. At some point in my web interface, I have an element with multiple classes, out of which one class needs to be removed. I am using Element.removeClassName(element, "classname to remove"); to achieve this. This call does remove the specified class name. So far so good. But after the call, instead of a space, the remaining classes are separated by a "," and IE and FF do not apply these remaining classes. The problem is better represented at http://katdare.com/temp/remove_classname.html Now, in prototype.js (1.4.0_rc1), if I change the following snippet remove: function(classNameToRemove) { if (!this.include(classNameToRemove)) return; this.set(this.select(function(className) { return className != classNameToRemove; })); }, to remove: function(classNameToRemove) { if (!this.include(classNameToRemove)) return; this.set(this.select(function(className) { return className != classNameToRemove; }).join('' '')); }, it seems to work as expected. Apologies if this has already been addressed. Thanks, Amol Katdare
Thomas Fuchs
2005-Nov-10 10:45 UTC
Re: Element.removeClassName(..) - bug or incorrect usage?
There''s already a ticket on this here: http://dev.rubyonrails.com/ticket/2783 Thanks for reporting anyway. :) Cheers, Thomas Am 09.11.2005 um 18:16 schrieb Amol Katdare:> Hi, > > I have just started using prototype.js and scriptaculous.js in one of > my projects. These libraries are awesome and they let me do so much > more, so easily. > > At some point in my web interface, I have an element with multiple > classes, out of which one class needs to be removed. > I am using > Element.removeClassName(element, "classname to remove"); > to achieve this. > > This call does remove the specified class name. So far so good. > But after the call, instead of a space, the remaining classes are > separated by a "," and IE and FF do not apply these remaining classes. > > The problem is better represented at > http://katdare.com/temp/remove_classname.html > > Now, in prototype.js (1.4.0_rc1), if I change the following snippet > > remove: function(classNameToRemove) { > if (!this.include(classNameToRemove)) return; > this.set(this.select(function(className) { > return className != classNameToRemove; > })); > }, > > to > > remove: function(classNameToRemove) { > if (!this.include(classNameToRemove)) return; > this.set(this.select(function(className) { > return className != classNameToRemove; > }).join('' '')); > }, > > it seems to work as expected. > > Apologies if this has already been addressed. > > Thanks, > Amol Katdare > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs