diff options
author | Manolo Carrasco <manolo@apache.org> | 2012-10-01 07:24:08 +0200 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2012-10-01 07:24:08 +0200 |
commit | c887b71239fe7ed288abe07c170ba98d150b2a31 (patch) | |
tree | ae6189ccabfdca7c717f4b50e7cd9612f5ca8ee0 /gwtquery-core | |
parent | 7eec296cdcfe82c124261bb305aa1eda6b114693 (diff) | |
download | gwtquery-c887b71239fe7ed288abe07c170ba98d150b2a31.tar.gz gwtquery-c887b71239fe7ed288abe07c170ba98d150b2a31.zip |
Fix removeClass method, so as it remove all classes when argument is empty (like jquery does)
Diffstat (limited to 'gwtquery-core')
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java | 10 |
1 files 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<GQuery, LazyGQuery> { /**
* 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);
+ }
}
}
}
|