title: How to select from an html substring with node
body: <p>I have the following table:</p>
  <pre><code>function returnTable() {
  
      return `
      
      &lt;table class=&quot;table table-striped table-bordered table-condensed&quot;&gt;\
  
      &lt;tbody&gt;&lt;tr&gt;\
          &lt;th&gt;Type&lt;/th&gt;\
                              &lt;th&gt;Description&lt;/th&gt;\
  
                      &lt;td class=&quot;table-number&quot;&gt;$0&lt;/td&gt;\
  
  
          &lt;td class=&quot;table-number&quot;&gt;$0&lt;/td&gt;\
  
      &lt;/tr&gt;\
  
  &lt;/tbody&gt;&lt;/table&gt;
  `    
  }
  </code></pre>
  <p>I want to be able to parse it with node using selectors. I see that document.queryselector appears to require a full html document.</p>
  <p>I also tried:</p>
  <pre><code>function getTable1(page) {
  
      const newTable = document.createElement(page);
      console.log(newTable);
  }
  
  getTable1(returnTable())
  </code></pre>
  <p>But this gives:</p>
  <pre><code>const newTable = document.createElement(page);
                   ^
  ReferenceError: document is not defined
  </code></pre>
  <p>How to I parse an html substring in node? in other words use queryselector on a html fragment or substring?</p>