You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
710 B

  1. 'use strict';
  2. var implicitSetter = require('../parsers').implicitSetter;
  3. // the valid border-styles:
  4. var styles = [
  5. 'none',
  6. 'hidden',
  7. 'dotted',
  8. 'dashed',
  9. 'solid',
  10. 'double',
  11. 'groove',
  12. 'ridge',
  13. 'inset',
  14. 'outset',
  15. ];
  16. module.exports.isValid = function parse(v) {
  17. return typeof v === 'string' && (v === '' || styles.indexOf(v) !== -1);
  18. };
  19. var isValid = module.exports.isValid;
  20. var parser = function(v) {
  21. if (isValid(v)) {
  22. return v.toLowerCase();
  23. }
  24. return undefined;
  25. };
  26. module.exports.definition = {
  27. set: implicitSetter('border', 'style', isValid, parser),
  28. get: function() {
  29. return this.getPropertyValue('border-style');
  30. },
  31. enumerable: true,
  32. configurable: true,
  33. };