title: Work with AJAX response with DOM methods
body: <p>I'm retrieving an entire HTML document via AJAX - and that works fine. But I need to extract certain parts of that document and do things with them.</p>
  
  <p>Using a framework (jquery, mootools, etc) is not an option. </p>
  
  <p>The only solution I can think of is to grab the body of the HTML document with a regex (yes, I know, terrible) ie. <code>&lt;body&gt;(.*)&lt;/body&gt;</code> put that into the current page's DOM in a hidden element, and work with it from there.</p>
  
  <p>Is there an easier/better way?</p>
  
  <h2>Update</h2>
  
  <p>I've done some testing, and inserting an entire HTML document into a created element behaves a bit differently across browsers I've tested. For example:</p>
  
  <ul>
  <li>FF3.5: keeps the contents of the HEAD and BODY tags</li>
  <li>IE7 / Safari4: Only includes what's between ...</li>
  <li>Opera 10.10: Keeps HEAD and everything inside it, Keeps contents of BODY</li>
  </ul>
  
  <p>The behavior of IE7 and Safari are ideal, but different browsers are doing this differently. Since I'm loading a predetermined HTML document I think I'm going to use the regEx to grab what I want and insert it into a DOM element - unless someone has other suggestions.</p>