title: Do Javascript event listeners need to be removed prior to removing the element they're attached to?
body: <p>Suppose I have attached a variety of event listeners to various form elements. Later, I want to remove the entire form. </p>
  
  <p>Is it necessary (or suggested) to unregister any event handlers that exist on the form and its elements? If so, what is the easiest way to remove all listeners on a collection of elements? What are the repercussions of not doing so? I'm using Prototype, if it matters.</p>
  
  <p>Here's what I'm actually doing. I have a simple form, like this:</p>
  
  <pre><code>&lt;form id="form"&gt;
    &lt;input type="text" id="foo"/&gt;
    &lt;input type="text" id="bar"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I observe various events on the inputs, e.g.:</p>
  
  <pre><code>$('foo').observe('keypress', onFooKeypress);
  $('bar').observe('keypress', onBarKeypress);
  </code></pre>
  
  <p>etc.</p>
  
  <p>The form is submitted via AJAX and the response is a new copy of the form. I replace the old form with a copy of the new one doing something like <code>$('form').replace(newForm)</code>. Am I accumulating a bunch of event cruft?</p>