src/fragments.js
function(html) {
    if (!html) {
      throw new TypeError('Invalid html, cannot create a template from: ' + html);
    }
    var fragment = toFragment(html);
    if (fragment.childNodes.length === 0) {
      throw new Error('Cannot create a template from ' + html + ' because it is empty.');
    }
    var template = Template.makeInstanceOf(fragment);
    this.compileTemplate(template);
    return template;
  }
function(html) {
    if (!html) {
      throw new TypeError('Invalid html, cannot create a template from: ' + html);
    }
    var fragment = toFragment(html);
    if (fragment.childNodes.length === 0) {
      throw new Error('Cannot create a template from ' + html + ' because it is empty.');
    }
    var template = Template.makeInstanceOf(fragment);
    this.compileTemplate(template);
    return template;
  }
function ( html ) { if ( ! html ) { throw new TypeError ( 'Invalid html, cannot create a template from: ' + html ) ; } var fragment = toFragment ( html ) ; if ( fragment . childNodes . length === 0 ) { throw new Error ( 'Cannot create a template from ' + html + ' because it is empty.' ) ; } var template = Template . makeInstanceOf ( fragment ) ; this . compileTemplate ( template ) ; return template ; }
Takes an HTML string, an element, an array of elements, or a document fragment, and compiles it into a template.
Instances may then be created and bound to a given context.
@param {String|NodeList|HTMLCollection|HTMLTemplateElement|HTMLScriptElement|Node} html A Template can be created
from many different types of objects. Any of these will be converted into a document fragment for the template to
clone. Nodes and elements passed in will be removed from the DOM.
Takes an HTML string an element an array of elements or a document fragment and compiles it into a template . Instances may then be created and bound to a given context .