]> source.dussan.org Git - gwtquery.git/commitdiff
check if a widget is not yet attached to the element before to create a new one
authorJulien Dramaix <julien.dramaix@gmail.com>
Sat, 5 Mar 2011 19:51:13 +0000 (19:51 +0000)
committerJulien Dramaix <julien.dramaix@gmail.com>
Sat, 5 Mar 2011 19:51:13 +0000 (19:51 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java

index d5a08fb9fca55b006aefb6fe4d2814436c1b0bfd..a4fcceee68984592b0de0206ab4c5a13287297e7 100755 (executable)
@@ -157,7 +157,12 @@ public class Widgets extends QueuePlugin<Widgets> {
    */\r
   protected <W extends Widget> W widget(Element e,\r
       WidgetFactory<W> factory, Function... initFunctions) {\r
-\r
+    \r
+    if ($(e).widget() != null){\r
+      //a widget is already attached on this element !!\r
+      return null;\r
+    }\r
+    \r
     W widget = factory.create(e);\r
 \r
     if (initFunctions != null) {\r