title: Applying DOM Manipulations to HTML and saving the result?
body: <p>I have about 100 static HTML pages that I want to apply some DOM manipulations to. They all follow the same HTML structure. I want to apply some DOM manipulations to each of these files, and then save the resulting HTML.</p>
  
  <p>These are the manipulations I want to apply:</p>
  
  <pre><code># [start]
  $("h1.title, h2.description", this).wrap("&lt;hgroup&gt;");
  if ( $("h1.title").height() &lt; 200 ) {
    $("div.content").addClass('tall');
  }
  # [end]
  # SAVE NEW HTML
  </code></pre>
  
  <p>The first line (<code>.wrap()</code>) I could easily do with a find and replace, but it gets tricky when I have to determine the calculated height of an element, which can't be easily be determined sans-JavaScript. </p>
  
  <p>Does anyone know how I can achieve this? Thanks!</p>