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

## Statements: 100% (11 / 11) Branches: 100% (0 / 0) Functions: 100% (3 / 3) Lines: 100% (11 / 11) Ignored: none

All files » lib/template/vnode/block/ » hydrator.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
    1

    1
    111
    111
    111

    1

    111

    171
    171

     var protoclass = require("protoclass");
    var utils      = require("../../../utils");
    var Binding    = require("./binding");

    /**
     */

    function BlockHydrator(node, script, bindingClass) {
      this.node   = node;
      this.script = script;
      this.bindingClass = bindingClass;
    }

    /**
     */

    module.exports = protoclass(BlockHydrator, {

      /**
       */

      initialize: function() {
        this.nodePath = utils.getNodePath(this.node);
      },

      /**
       */

      hydrate: function(view) {
        var clonedNode = utils.getNodeByPath(view.rootNode, this.nodePath);
        view.bindings.push(new this.bindingClass(clonedNode, this.script, view));
      }
    });