// wipe existing DOM to avoid id conflicts. Use this flag to avoid having getCanvas() general a default
// Canvas on the first "switch".
if (senderCanvasInitialized) {
Layout senderLayout = (Layout) senderCanvasItem.getCanvas();
EnhancedUtility.destroyMembers(senderLayout);
senderLayout.destroy();
}
senderCanvasInitialized = true;
senderCanvasItem.setCanvas(newCanvas);
markForRedraw();
}