Code coverage report for juice\lib\property.js

Statements: 92.31% (12 / 13)      Branches: 100% (4 / 4)      Functions: 66.67% (2 / 3)      Lines: 91.67% (11 / 12)      Ignored: none     

All files » juice\lib\ » property.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 48 49 50 51 52 53 54 55              1           1                     1 80 80 80                 1 11       11 4                 1      
 
/**
 * juice
 * Copyright(c) 2011 LearnBoost <dev@learnboost.com>
 * MIT Licensed
 */
 
module.exports = exports = Property;
 
/**
 * Module dependencies.
 */
 
var compare = require('./utils').compare
 
/**
 * CSS property constructor.
 *
 * @param {String} property
 * @param {String} value
 * @param {Selector} selector the property originates from
 * @api public
 */
 
function Property (prop, value, selector) {
  this.prop = prop;
  this.value = value;
  this.selector = selector
}
 
/**
 * Compares with another Property based on Selector#specificity.
 *
 * @api public
 */
 
Property.prototype.compare = function (property) {
  var a = this.selector.specificity()
    , b = property.selector.specificity()
    , winner = compare(a, b)
 
  if (winner === a && a !== b) return this;
  return property;
};
 
/**
 * Returns CSS property
 *
 * @api public
 */
 
Property.prototype.toString = function () {
  return this.prop + ': ' + this.value.replace(/['"]+/g, '') + ';';
};