# 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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    321

    1
    151

    1

    208
    102
    120

    1
    30

     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);
        return template.nodeFactory.createFragment(this.children.map(function(child) {
          return child.initialize(template);
        }));
      }
    });

    /**
     */

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