Skip to content

Instantly share code, notes, and snippets.

@mahboob-awan
Last active May 12, 2020 10:28
Show Gist options
  • Save mahboob-awan/a2236fb8782408a7c4f94f874582607c to your computer and use it in GitHub Desktop.
Save mahboob-awan/a2236fb8782408a7c4f94f874582607c to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
<div id="temporaryElement">
<div id="internalElement">
This element will remove in 3 sec
</div>
</div>
var temporaryElement = document.getElementById("temporaryElement");
var internalElement = document.getElementById("internalElement");
(function (arr) { arr.forEach(function (item) { if (item.hasOwnProperty('remove')) { return; } Object.defineProperty(item, 'remove', { configurable: true, enumerable: true, writable: true, value: function remove() { if (this.parentNode !== null) this.parentNode.removeChild(this); } }); });})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
console.log("BEFORE:",internalElement.getBoundingClientRect());
temporaryElement.remove();
setTimeout(function(){
console.log("AFTER: ",internalElement.getBoundingClientRect());
}, 2000);
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment