JavaScript Ninja – Event Purge (No jQuery Needed..)

SpamCop.net has a 50,000 characters limit, which applied just before submitting a “Spam Report” form,
on that case it is enforced using an inline-(attribute) event: onsubmit="return formval(50000);"

other ways are using either onsubmit as event-handler (element.onsubmit = function(ev){...) or the element.addEventListener(...) method.

while setting an event handler yourself and removing it is quite easy,
unhooking (removing event handler) is not always as easy when it has came from the page’s body or external script-resources,
(most of the times it requires quite a bit of digging through the developer-console/panel)

there is, however, another way.
cloning an element (well.. Node) returns an unmodified/”original DOM” version as parsed from the page’s source,
ignoring later assign events, but does include every inline-attribute (inline-event handlers included),

blah blah.. technical stuff..

so, essentially:
1. cloneNode(true)
2. removeAttribute('on...')

here is how to “fix” the SpamCop.net limitation ;)

Array.prototype.forEach.call(document.querySelectorAll('form, input, textarea'), function(element, tmp){
  element.parentNode.replaceChild(element.cloneNode(true), element);
});
Array.prototype.forEach.call(document.querySelectorAll('form'), function(element){
  element.removeAttribute('onsubmit')
});