title: Returning contents of template tag as string
body: <p>I was wondering if there was a way of getting the contents of the elements within a template tag and returning it as a string?  At the moment it seems like it is returning something along the lines on <code>[object document fragment]</code> but want just the html content inside.</p>
  
  <pre><code>function CreateWidget(widget) {
      //Check if browser supports templates
      if ('content' in document.createElement('template')) {
          //Grab the template's content and assign it to a variable so we only have the gut of the template
          var widgetContent = document.querySelector('#panel-template').content //('#panel-template').get(1).setAttribute('id', widget.WidgetCode);
          widgetContent.querySelector('#chart').setAttribute('id', widget.WidgetCode);
  
          //get the overlay toolbar
          var widgetOverlay = widgetContent.querySelector('.overlayed');
          widgetOverlay.setAttribute('data-render', widget.WidgetCode);
          widgetOverlay.setAttribute('data-chartType', widget.chartType);
          widgetOverlay.setAttribute('data-devID', widget.deviceID);
          widgetOverlay.setAttribute('data-metricType', widget.metricType);
          widgetOverlay.setAttribute('data-title', widget.WidgetName);
  
          var el = document.importNode(widgetContent, true);
          alert(el);   
      }
  }
  </code></pre>