Code coverage report for lib/attributes/style.js

Statements: 18.75% (3 / 16)      Branches: 0% (0 / 8)      Functions: 0% (0 / 3)      Lines: 18.75% (3 / 16)      Ignored: none     

All files » lib/attributes/ » style.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 46 47 481         1                                                                             1      
var ScriptAttribute = require("./script");
 
/**
 */
 
module.exports = ScriptAttribute.extend({
 
  /**
   */
 
  bind: function() {
    this._currentStyles = {};
    ScriptAttribute.prototype.bind.call(this);
  },
 
  /**
   */
 
  update: function() {
 
    var styles = this.currentValue;
 
    var newStyles = {};
 
    for (var name in styles) {
      var style = styles[name];
      if (style !== this._currentStyles[name]) {
        newStyles[name] = this._currentStyles[name] = style || "";
      }
    }
 
    if (this.node.__isNode) {
      this.node.style.setProperties(newStyles);
    } else {
      for (var key in newStyles) {
        this.node.style[key] = newStyles[key];
      }
    }
  }
});
 
/**
 */
 
module.exports.test = function(value) {
  return typeof value === "object" && !value.buffered;
};