diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2012-11-07 23:17:32 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2012-11-07 23:17:32 +0100 |
commit | 2a61f56909dc0728c95f98e591c498c78de2e55d (patch) | |
tree | ccfc6c4422b299bc15e67b41393d3b1c5b449ec0 /gwtquery-core | |
parent | a4ebe76825a73a35d073b2a08d058c0f1808948c (diff) | |
download | gwtquery-2a61f56909dc0728c95f98e591c498c78de2e55d.tar.gz gwtquery-2a61f56909dc0728c95f98e591c498c78de2e55d.zip |
Fix live() method failing when there were multiple functions for the same selector
Diffstat (limited to 'gwtquery-core')
-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 | 10 |
2 files changed, 5 insertions, 7 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 ba3e084e..682876ca 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 @@ -256,7 +256,7 @@ public class EventsListener implements EventListener { if (f.hasEventType(event.getTypeInt())) { NodeList<Element> n = realCurrentTargetBySelector.get(cssSelector); for (int j = 0; n != null && j < n.getLength(); j++) { - Element element = n.getItem(i); + Element element = n.getItem(j); // When an event fired in an element stops bubbling we have to fire also all other // handlers for this element bound to this element if (stopElement == null || element.equals(stopElement)) { 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 17eef27c..9f91cbd1 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 @@ -600,7 +600,6 @@ public class GQueryEventsTestGwt extends GWTTestCase { } public void testLiveWithMultipleFunction() { - $(e).html("<div id='div1'><div id='div2'>Content 1<span id='span1'> blop</span></div></div>"); $(".clickable", e).live("click", new Function() { @@ -614,12 +613,10 @@ public class GQueryEventsTestGwt extends GWTTestCase { }); $("#div1", e).addClass("clickable"); - $("#span1", e).click(); assertEquals("red", $("#div1", e).css(CSS.COLOR, false)); - assertNotSame("yellow", $("#div1", e).css(CSS.BACKGROUND_COLOR, false)); - + assertEquals("yellow", $("#div1", e).css(CSS.BACKGROUND_COLOR, false)); } public void testMouseenterEvent() { @@ -950,7 +947,8 @@ public class GQueryEventsTestGwt extends GWTTestCase { g.resize(); } - @DoNotRunWith({Platform.HtmlUnitLayout}) + @DoNotRunWith({Platform.HtmlUnitLayout, Platform.Prod}) + // FIXME: Window.resizeTo does not resize the window, maybe we need a different approach. public void testResizeWindowEvent() { GQuery w = $(GQuery.window); @@ -960,7 +958,7 @@ public class GQueryEventsTestGwt extends GWTTestCase { finishTest(); } }); - + Window.resizeTo(w.width(), w.height() + 100); } |