Code coverage report for lib/template/vnode/element/attributeHydrator.js

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

All files » lib/template/vnode/element/ » attributeHydrator.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 42 43 44 45 461 1 1         1 9 9 9 9           1           9               9                     9      
var protoclass        = require("protoclass");
var utils             = require("../../../utils");
var AttributesBinding = require("./attributesBinding");
 
/**
 */
 
function AttributeHydrator(attrClass, key, value, node) {
  this.node      = node;
  this.key       = key;
  this.value     = value;
  this.attrClass = attrClass;
}
 
/**
 */
 
module.exports = protoclass(AttributeHydrator, {
 
  /**
   */
 
  initialize: function() {
    this.nodePath = utils.getNodePath(this.node);
  },
 
  /**
   */
 
  hydrate: function(view) {
 
    var attribute = new this.attrClass({
 
      // attribute handlers can only be added to real elements for now since
      // components can have any number of dynamic text/element children - which won't
      // have attribute handlers attached to them such as onClick, onEnter, etc.
      node: utils.getNodeByPath(view.rootNode, this.nodePath),
      view: view,
      key: this.key,
      value: this.value
    });
 
    view.bindings.push(attribute);
  }
});