Code coverage report for lib/template/vnode/fragment/index.js

Statements: 100% (12 / 12)      Branches: 100% (2 / 2)      Functions: 100% (4 / 4)      Lines: 100% (11 / 11)      Ignored: none     

All files » lib/template/vnode/fragment/ » index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 341         1 11           1           11 4 4 3   4             1 1    
var protoclass = require("protoclass");
 
/**
 */
 
function Fragment(children) {
  this.children = children;
}
 
/**
 */
 
module.exports = protoclass(Fragment, {
 
  /**
   */
 
  initialize: function(template) {
    if (this.children.length === 1) return this.children[0].initialize(template);
    var frag = template.document.createDocumentFragment();
    this.children.forEach(function(child) {
      frag.appendChild(child.initialize(template));
    });
    return frag;
  }
});
 
/**
 */
 
module.exports.create = function(children) {
  return new Fragment(children);
};