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

Statements: 23.53% (4 / 17)      Branches: 0% (0 / 6)      Functions: 0% (0 / 3)      Lines: 25% (4 / 16)      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 41 421 1         1                   1                                                  
var protoclass = require("protoclass");
var utils      = require("../../../utils");
 
/**
 */
 
function UnboundBlockBinding(node, script, view) {
  this.view   = view;
  this.document = view.template.document;
  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);
 
    if (this.document !== global.document) {
      this.node.replaceText(v, true);
    } else {
      this.node.nodeValue = String(v);
    }
  },
 
  /**
   */
 
  unbind: function() { }
});