clear.js 752 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. const parsers = require("../parsers");
  3. module.exports.parse = function parse(v) {
  4. const keywords = [
  5. "inline-start",
  6. "inline-end",
  7. "block-start",
  8. "block-end",
  9. "left",
  10. "right",
  11. "top",
  12. "bottom",
  13. "both-inline",
  14. "both-block",
  15. "both",
  16. "none"
  17. ];
  18. return parsers.parseKeyword(v, keywords);
  19. };
  20. module.exports.isValid = function isValid(v) {
  21. if (v === "") {
  22. return true;
  23. }
  24. return typeof module.exports.parse(v) === "string";
  25. };
  26. module.exports.definition = {
  27. set(v) {
  28. v = parsers.prepareValue(v, this._global);
  29. this._setProperty("clear", module.exports.parse(v));
  30. },
  31. get() {
  32. return this.getPropertyValue("clear");
  33. },
  34. enumerable: true,
  35. configurable: true
  36. };