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

## Statements: 40% (4 / 10) Branches: 0% (0 / 2) Functions: 0% (0 / 4) Lines: 44.44% (4 / 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

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

    /**
     */

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