title: Is there a way to measure page weight programmatically in JavaScript?
body: <p>I am working on a web application that dynamically builds the UI by manipulating the HTML DOM with JavaScript. </p>
  
  <p>I would like take action - such as clearing out old information - if the size of the document being built is getting too big (assume some arbitrary figure). </p>
  
  <p>Is it possible to programmatically query the DOM to know what the size of the DOM is - either as bytes of equivalent HTML text (i.e file size), or ideally as amount of memory taken up by the DOM?</p>