flexBasis.js 577 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. var parseMeasurement = require('../parsers').parseMeasurement;
  3. function parse(v) {
  4. if (String(v).toLowerCase() === 'auto') {
  5. return 'auto';
  6. }
  7. if (String(v).toLowerCase() === 'inherit') {
  8. return 'inherit';
  9. }
  10. return parseMeasurement(v);
  11. }
  12. module.exports.isValid = function isValid(v) {
  13. return parse(v) !== undefined;
  14. };
  15. module.exports.definition = {
  16. set: function(v) {
  17. this._setProperty('flex-basis', parse(v));
  18. },
  19. get: function() {
  20. return this.getPropertyValue('flex-basis');
  21. },
  22. enumerable: true,
  23. configurable: true,
  24. };