title: html2canvas - error: Element is not attached to a Document
body: <p>I have 2 function.</p>
  <pre><code>function test() {
      // Get the element.
      var element = document.getElementById('container');
  
      // Generate the PDF.
      html2pdf().from(element).set({
          margin: 1,
          foreignObjectRendering: true,
          filename: 'test.pdf',
          html2canvas: { scale: 2 },
          jsPDF: {orientation: 'portrait', unit: 'in', format: 'letter', compressPDF: true}
      }).save();
  }
  
  $(function() {
      $(&quot;#btnSave&quot;).click(function() {
          html2canvas($(&quot;#container&quot;), {
              onrendered: function(canvas) {
                  theCanvas = canvas;
                  document.body.appendChild(canvas);
  
                  // Convert and download as image
                  Canvas2Image.saveAsPNG(canvas);
                  $(&quot;#img-out&quot;).append(canvas);
                  // Clean up
                  //document.body.removeChild(canvas);
              }
          });
      });
  });  
  </code></pre>
  <p>And one div</p>
  <pre><code>&lt;div id=&quot;container&quot; style=&quot;width: 1000px; height: 500px; background-color: #1b5c72;&quot;&gt;
      &lt;div onclick=&quot;doSomething(event, this); changeColor(event, this)&quot;  class=&quot;magnet&quot; style=&quot;display: inline-block;&quot;&gt;
          &lt;object   class=&quot;123&quot; style=&quot;pointer-events: none&quot;  width=&quot;200&quot;
                  height=&quot;300&quot;
                  type=&quot;image/svg+xml&quot;
                  data=&quot;images/tiles/a4-vertical.svg&quot;&gt;
          &lt;/object&gt;
   &lt;/div&gt;
      &lt;div style=&quot;background-color: red; width: 100px; height: 100px;&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I can't convert div to canvas in second function and can't make good pdf in first function.  don't appear in canvas and in pdf. I see only empty main div and little red div without svg.<br />
  html2canvas  don't work with <code>&lt;object&gt;</code>?</p>