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

## Statements: 100% (10 / 10) Branches: 100% (2 / 2) Functions: 100% (3 / 3) Lines: 100% (10 / 10) Ignored: none

All files » lib/template/vnode/block/ » index.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    231

    1
    86

    1

    88
    88
    88
    88

    1
    86
     var protoclass = require("protoclass"),
    utils          = require("../../../utils"),
    script         = require("../../../script"),
    Hydrator       = require("./hydrator"),
    Binding        = require("./binding"),
    Unbound        = require("./unbound");

    function Block (scriptSource) {
      this.script  = script(scriptSource);
    }

    module.exports = protoclass(Block, {
      initialize: function (template) {
        var node = template.nodeFactory.createTextNode("");
        var bindingClass = this.script.refs.length ? Binding : Unbound;
        template.hydrators.push(new Hydrator(node, this.script, bindingClass));
        return node;
      }
    });

    module.exports.create = function (script) {
      return new Block(script);
    }