From 55ebe132a2e50695944cf172c36fcfcf3377d1b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Thu, 13 Jun 2013 10:29:57 +0300 Subject: [PATCH] Detach and attach when adding or removing the caption wrapper (#11708) Change-Id: Ie6de4863587189ef1105cc41211b224c126f6ebd --- client/src/com/vaadin/client/ui/orderedlayout/Slot.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java index 00ff5bbc5a..49b3661431 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java @@ -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; -- 2.39.5