borderBottomStyle.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. const parsers = require("../parsers");
  3. module.exports.parse = function parse(v) {
  4. const keywords = [
  5. "none",
  6. "hidden",
  7. "dotted",
  8. "dashed",
  9. "solid",
  10. "double",
  11. "groove",
  12. "ridge",
  13. "inset",
  14. "outset"
  15. ];
  16. return parsers.parseKeyword(v, keywords);
  17. };
  18. module.exports.isValid = function isValid(v) {
  19. if (v === "") {
  20. return true;
  21. }
  22. return typeof module.exports.parse(v) === "string";
  23. };
  24. module.exports.definition = {
  25. set(v) {
  26. v = parsers.prepareValue(v, this._global);
  27. const val = module.exports.parse(v);
  28. if (val === "none" || val === "hidden") {
  29. this._setProperty("border-bottom-style", "");
  30. this._setProperty("border-bottom-color", "");
  31. this._setProperty("border-bottom-width", "");
  32. return;
  33. }
  34. if (parsers.hasVarFunc(v)) {
  35. this._setProperty("border", "");
  36. this._setProperty("border-bottom", "");
  37. this._setProperty("border-style", "");
  38. }
  39. this._setProperty("border-bottom-style", val);
  40. },
  41. get() {
  42. return this.getPropertyValue("border-bottom-style");
  43. },
  44. enumerable: true,
  45. configurable: true
  46. };