From 723156e45fc855d5d993e1ea58cdab1cf2aafd0b Mon Sep 17 00:00:00 2001 From: jdramaix Date: Wed, 23 Jan 2013 01:48:17 +0100 Subject: fix issue #12 --- .../src/main/java/com/google/gwt/query/client/js/JsMap.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsMap.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsMap.java index b0c1ebb1..2c87171d 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsMap.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsMap.java @@ -43,6 +43,12 @@ final public class JsMap extends JavaScriptObject { c().put(key.hashCode(), val); } + public T remove(S key){ + T old = get(key); + c().delete(key.hashCode()); + return old; + } + public final String[] keys() { return c().keys(); } -- cgit v1.2.3 From 00eae0430276e873ebb1ba083a984e84b0e821a1 Mon Sep 17 00:00:00 2001 From: jdramaix Date: Wed, 23 Jan 2013 01:50:03 +0100 Subject: fix issue #12 --- .../com/google/gwt/query/client/plugins/events/EventsListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java index 6ba03bae..1f239fdc 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java @@ -16,6 +16,7 @@ package com.google.gwt.query.client.plugins.events; import static com.google.gwt.query.client.GQuery.$; import com.google.gwt.core.client.Duration; +import com.google.gwt.core.client.JsArrayString; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.EventTarget; import com.google.gwt.dom.client.NodeList; @@ -531,12 +532,18 @@ public class EventsListener implements EventListener { for (String k : liveBindFunctionByEventType.keys()) { LiveBindFunction liveBindFunction = liveBindFunctionByEventType. cast().get(k); liveBindFunction.removeBindFunctionForSelector(cssSelector, nameSpace, null); + if (liveBindFunction.isEmpty()){ + liveBindFunctionByEventType.cast().delete(k); + } } } else { LiveBindFunction liveBindFunction = liveBindFunctionByEventType.get(eventbits); if (liveBindFunction != null) { liveBindFunction.removeBindFunctionForSelector(cssSelector, nameSpace, originalEventName); } + if (liveBindFunction.isEmpty()){ + liveBindFunctionByEventType.remove(eventbits); + } } } -- cgit v1.2.3