title: Is there a way to access DOM outside of documentElement <html>?
body: <p>I have a script that searches a webpage for all comments and returns them in an array.</p>
  
  <pre><code>function getAllComments(rootElem) {
    var comments = [];
    var iterator = document.createNodeIterator(rootElem, NodeFilter.SHOW_COMMENT, filterNone, false);
    var curNode;
    while (curNode = iterator.nextNode()) {
      comments.push(curNode.nodeValue);
    }
    return comments;
  }
  </code></pre>
  
  <p>I have it search for any comments within the <code>&lt;html&gt;</code> tag:</p>
  
  <pre><code>pre.textContent = getAllComments(document.documentElement);
  </code></pre>
  
  <p>However, there are sometimes comments outside the <code>&lt;html&gt;</code> tag, like on this site: <a href="http://brianmetcalf.com" rel="nofollow noreferrer">http://brianmetcalf.com</a></p>
  
  <p>Is there a way to target an element higher up the chain than <code>documentElement</code>?</p>