border.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. var shorthandSetter = require('../parsers').shorthandSetter;
  3. var shorthandGetter = require('../parsers').shorthandGetter;
  4. var shorthand_for = {
  5. 'border-width': require('./borderWidth'),
  6. 'border-style': require('./borderStyle'),
  7. 'border-color': require('./borderColor'),
  8. };
  9. var myShorthandSetter = shorthandSetter('border', shorthand_for);
  10. var myShorthandGetter = shorthandGetter('border', shorthand_for);
  11. module.exports.definition = {
  12. set: function(v) {
  13. if (v.toString().toLowerCase() === 'none') {
  14. v = '';
  15. }
  16. myShorthandSetter.call(this, v);
  17. this.removeProperty('border-top');
  18. this.removeProperty('border-left');
  19. this.removeProperty('border-right');
  20. this.removeProperty('border-bottom');
  21. this._values['border-top'] = this._values.border;
  22. this._values['border-left'] = this._values.border;
  23. this._values['border-right'] = this._values.border;
  24. this._values['border-bottom'] = this._values.border;
  25. },
  26. get: myShorthandGetter,
  27. enumerable: true,
  28. configurable: true,
  29. };