Skip to content

Instantly share code, notes, and snippets.

@joahg
Last active March 4, 2020 13:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save joahg/8943220 to your computer and use it in GitHub Desktop.
Save joahg/8943220 to your computer and use it in GitHub Desktop.
domSniper is a simple JavaScript bookmarklet to easily remove a DOM node from a document using JavaScript
(function(){
var body = document.body;
var snipe = function(e) {
body.style.cursor = 'initial';
e.preventDefault();
e.target.parentNode.removeChild(e.target);
body.removeEventListener('click', snipe, false);
};
body.addEventListener('click', snipe, false);
body.style.cursor = 'crosshair';
})();
(function(){var body=document.body,snipe=function(a){body.style.cursor="initial",a.preventDefault(),a.target.parentNode.removeChild(a.target),body.removeEventListener("click",snipe,!1)};body.addEventListener("click",snipe,!1),body.style.cursor="crosshair";})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment