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

## Statements: 93.75% (15 / 16) Branches: 83.33% (5 / 6) Functions: 100% (3 / 3) Lines: 93.33% (14 / 15) Ignored: none

All files » lib/template/vnode/block/ » unbound.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
    34
    35
    36
    37
    38
    39
    40
    411

    1
    27
    27
    27
    27

    1

    31
    31
    31
    30

    30

    30
    30

     var protoclass = require("protoclass"),
    utils          = require("../../../utils");

    /**
     */

    function UnboundBlockBinding(node, script, view) {
      this.view   = view;
      this.nodeFactory = view.template.nodeFactory;
      this.script = script;
      this.node   = node;
    }

    /**
     */

    module.exports = protoclass(UnboundBlockBinding, {

      /**
       */

      bind: function() {
        var self = this;
        var value = this.script.evaluate(this.view);
        if (this.value === value) return;
        this.value = value;

        var v = String(value == null ? "" : value);

        Eif (this.nodeFactory.name !== "dom") {
          this.node.replaceText(v, true);
        } else {
          this.node.nodeValue = String(v);
        }
      },

      /**
       */

      unbind: function() { }
    });