]> source.dussan.org Git - vaadin-framework.git/commitdiff
Detach and attach when adding or removing the caption wrapper (#11708)
authorLeif Åstrand <leif@vaadin.com>
Thu, 13 Jun 2013 07:29:57 +0000 (10:29 +0300)
committerVaadin Code Review <review@vaadin.com>
Thu, 13 Jun 2013 08:03:50 +0000 (08:03 +0000)
Change-Id: Ie6de4863587189ef1105cc41211b224c126f6ebd

client/src/com/vaadin/client/ui/orderedlayout/Slot.java

index 00ff5bbc5a63248a816057069a3980d5abee8c2b..49b36614312a7e243d31d9e133701f074515535d 100644 (file)
@@ -455,6 +455,7 @@ public final class Slot extends SimplePanel {
         // since last time, and only run those changes
 
         // Caption wrappers
+        Widget widget = getWidget();
         if (captionText != null || iconUrl != null || error != null || required) {
             if (caption == null) {
                 caption = DOM.createDiv();
@@ -462,10 +463,14 @@ public final class Slot extends SimplePanel {
                 captionWrap.addClassName(StyleConstants.UI_WIDGET);
                 captionWrap.addClassName("v-has-caption");
                 getElement().appendChild(captionWrap);
-                captionWrap.appendChild(getWidget().getElement());
+                orphan(widget);
+                captionWrap.appendChild(widget.getElement());
+                adopt(widget);
             }
         } else if (caption != null) {
-            getElement().appendChild(getWidget().getElement());
+            orphan(widget);
+            getElement().appendChild(widget.getElement());
+            adopt(widget);
             captionWrap.removeFromParent();
             caption = null;
             captionWrap = null;