Skip to content

Instantly share code, notes, and snippets.

@guilhermehn
Created March 7, 2012 13:47
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 guilhermehn/1993257 to your computer and use it in GitHub Desktop.
Save guilhermehn/1993257 to your computer and use it in GitHub Desktop.
Javascript: Kill hard-coded events
(function(d) {
var tags = d.body.getElementsByTagName('*');
var i = tags.length;
while (i--) {
var attr = tags[i].attributes;
var ii = attr.length;
while (ii--) {
if (attr[ii].name.match(/^on/i)) {
tags[i][attr[ii].name] = null;
}
}
}
})(this.document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment