title: Add/remove listeners on JavaScript ( garbage collector )
body: <p>I have a quick question regarding on adding/removing listeners of a DOM object.
  I would like to ask if the garbage collector be able to collect the memory when removing elements from the page.</p>
  <p>Example: a <code>&lt;ul&gt;</code> tag with a couple list of children(<code>&lt;li&gt;</code>)</p>
  <pre><code>var ul = document.getElementById('someParent');
  var children = ul.children;
  var someFunction = function() {};
  
  for(var i = 0; i &lt; children.length; i++) {
    children[i].addEventListener('click', someFunction);
  }
  
  
  // This is where I am not sure, would the garbage collector be able to collect
  // the memory allocated on adding listener on children,
  // if I remove the ul tag?
  ul.remove();
  </code></pre>