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

## Statements: 100% (9 / 9) Branches: 100% (0 / 0) Functions: 100% (3 / 3) Lines: 100% (9 / 9) 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
    331

    1
    92
    92
    92

    1

    92

    479
    479

     var protoclass = require("protoclass"),
    utils          = require("../../../utils"),
    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));
      }
    });