fontSize.js 776 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. var TYPES = require('../parsers').TYPES;
  3. var valueType = require('../parsers').valueType;
  4. var absoluteSizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
  5. var relativeSizes = ['larger', 'smaller'];
  6. module.exports.isValid = function(v) {
  7. var type = valueType(v.toLowerCase());
  8. return (
  9. type === TYPES.LENGTH ||
  10. type === TYPES.PERCENT ||
  11. (type === TYPES.KEYWORD && absoluteSizes.indexOf(v.toLowerCase()) !== -1) ||
  12. (type === TYPES.KEYWORD && relativeSizes.indexOf(v.toLowerCase()) !== -1)
  13. );
  14. };
  15. module.exports.definition = {
  16. set: function(v) {
  17. this._setProperty('font-size', v);
  18. },
  19. get: function() {
  20. return this.getPropertyValue('font-size');
  21. },
  22. enumerable: true,
  23. configurable: true,
  24. };