From: Manolo Carrasco Date: Mon, 1 Oct 2012 05:24:08 +0000 (+0200) Subject: Fix removeClass method, so as it remove all classes when argument is empty (like... X-Git-Tag: release-1.3.2~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c887b71239fe7ed288abe07c170ba98d150b2a31;p=gwtquery.git Fix removeClass method, so as it remove all classes when argument is empty (like jquery does) --- diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index b18e3b03..a2abd8ca 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -3485,12 +3485,18 @@ public class GQuery implements Lazy { /** * Removes the specified classes to each matched element. + * + * If no arguments are provided, it removes all classes like jquery does. */ public GQuery removeClass(String... classes) { for (Element e : elements) { if (Element.is(e)) { - for (String clz : classes) { - e.removeClassName(clz); + if (classes.length == 0) { + e.setClassName(null); + } else { + for (String clz : classes) { + e.removeClassName(clz); + } } } }