Skip to content

Instantly share code, notes, and snippets.

@anton-gorbikov
Created November 21, 2018 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anton-gorbikov/90c37086c38435bf013dd36455bc0f3d to your computer and use it in GitHub Desktop.
Save anton-gorbikov/90c37086c38435bf013dd36455bc0f3d to your computer and use it in GitHub Desktop.
var myDemoObject = {
element: document.querySelector('#toRemove'),
child: {
element: document.querySelector('#toRetain')
}
};
// Removing DOM sub-tree after some user interactions
myDemoObject.element.parentNode.removeChild(myDemoObject.element);
// Clearing the reference to this DOM, it's not required anymore
myDemoObject.element = null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment