borderRightWidth.js 861 B

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. const parsers = require("../parsers");
  3. module.exports.parse = function parse(v) {
  4. const keywords = ["thin", "medium", "thick"];
  5. const key = parsers.parseKeyword(v, keywords);
  6. if (key) {
  7. return key;
  8. }
  9. return parsers.parseLength(v, true);
  10. };
  11. module.exports.isValid = function isValid(v) {
  12. if (v === "") {
  13. return true;
  14. }
  15. return typeof module.exports.parse(v) === "string";
  16. };
  17. module.exports.definition = {
  18. set(v) {
  19. v = parsers.prepareValue(v, this._global);
  20. if (parsers.hasVarFunc(v)) {
  21. this._setProperty("border", "");
  22. this._setProperty("border-right", "");
  23. this._setProperty("border-width", "");
  24. }
  25. this._setProperty("border-right-width", module.exports.parse(v));
  26. },
  27. get() {
  28. return this.getPropertyValue("border-right-width");
  29. },
  30. enumerable: true,
  31. configurable: true
  32. };