From c887b71239fe7ed288abe07c170ba98d150b2a31 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Mon, 1 Oct 2012 07:24:08 +0200 Subject: [PATCH] Fix removeClass method, so as it remove all classes when argument is empty (like jquery does) --- .../main/java/com/google/gwt/query/client/GQuery.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); + } } } } -- 2.39.5