title: Do elements created with document.createElement stay in memory?
body: <p>Hi, I'm slowly making a chrome extension, and I need to parse some data that contains html entities, and I need to decode it. I saw in an answer here that I could use <code>document.createElement</code> for it, so I did this:</p>
  
  <pre class="lang-js prettyprint-override"><code>htmlDecode: function(input) {
      if(/[&lt;&gt;]/.test(input)) { // To avoid creating tags like &lt;script&gt; :s
          return "Invalid Input";
      }
      var e = document.createElement('div');
      e.innerHTML = input;
      return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
  }
  </code></pre>
  
  <p>However I'm worried that <code>document.createElement</code> leaves elements behind because this function runs on the background script, so it's not like it gets refreshed often, and it runs around 35000 times every 5 minutes.</p>
  
  <p>So, do elements created by <code>document.createElement</code> get freed, or do they stay?
  I mean, I do not append them anywhere and they are assiged to a local variable, but I'm not sure.</p>