At a number of places in the code, we have effectively reimplemented Phosphor's Widget.attach and Widget.detach, but omitted the checks that Phosphor expects to be performed for those operations. That is a bad idea, because it means that we are telling widgets that they are attached or detached when not all the conditions that should apply do apply. We should explicitly mark those locations so that we know where we should go fix them later.
The child of the host element to insert the widget before. Ordinarily the following checks should be performed: The widget should have no parent The widget should not be attached, and its node should not be a child of document.body The host should be a child of document.body We often violate the last condition.
Ordinarily, the following checks should be performed before detaching a widget: It should not be the child of another widget It should be attached and it should be a child of document.body