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

## Statements: 100% (10 / 10) Branches: 100% (2 / 2) Functions: 100% (4 / 4) Lines: 100% (9 / 9) 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
    201

    1
    144

    1

    201
    96
    111

    1
    26
     var protoclass = require("protoclass")

    // this is the base class for registered components

    function Fragment (children) {
      this.children = children;
    }

    module.exports = protoclass(Fragment, {
      initialize: function (template) {
        if (this.children.length === 1) return this.children[0].initialize(template);
        return template.nodeFactory.createFragment(this.children.map(function (child) {
          return child.initialize(template);
        }));
      }
    });

    module.exports.create = function (children) {
      return new Fragment(children);
    }