No Description

flex-values.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. (function() {
  2. var FlexValues, OldValue, Value,
  3. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  4. hasProp = {}.hasOwnProperty;
  5. OldValue = require('../old-value');
  6. Value = require('../value');
  7. FlexValues = (function(superClass) {
  8. extend(FlexValues, superClass);
  9. function FlexValues() {
  10. return FlexValues.__super__.constructor.apply(this, arguments);
  11. }
  12. FlexValues.names = ['flex', 'flex-grow', 'flex-shrink', 'flex-basis'];
  13. FlexValues.prototype.prefixed = function(prefix) {
  14. return this.all.prefixed(this.name, prefix);
  15. };
  16. FlexValues.prototype.replace = function(string, prefix) {
  17. return string.replace(this.regexp(), '$1' + this.prefixed(prefix) + '$3');
  18. };
  19. FlexValues.prototype.old = function(prefix) {
  20. return new OldValue(this.name, this.prefixed(prefix));
  21. };
  22. return FlexValues;
  23. })(Value);
  24. module.exports = FlexValues;
  25. }).call(this);