diff options
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java | 2 | ||||
-rw-r--r-- | gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java | 18 |
2 files changed, 19 insertions, 1 deletions
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 38366b60..77abf267 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 @@ -495,7 +495,7 @@ public class EventsListener implements EventListener { int etype = getTypeInt(event.getType()); String originalEventType = GqEvent.getOriginalEventType(event); - for (int i = 0; i < elementEvents.length(); i++) { + for (int i = 0, l = elementEvents.length(); i < l; i++) { BindFunction listener = elementEvents.get(i); if (listener.hasEventType(etype) && (originalEventType == null || originalEventType diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java index fbc4c3e8..c5bdc5ac 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java @@ -1223,5 +1223,23 @@ public class GQueryEventsTestGwt extends GWTTestCase { assertEquals("red", $("button").css("color", false)); assertEquals("black", $("button").css("background-color", false)); } + + public void testIssue152() { + $(e).html("<div class='mdiv'>"); + final GQuery div = $(".mdiv", e); + final int[] count = { 0 }; + div.one(Event.ONCLICK, null, new Function() { + public void f() { + count[0]++; + div.one(Event.ONCLICK, null, new Function() { + public void f() { + fail(); + } + }); + }; + }); + div.click(); + assertEquals(1, count[0]); + } } |