float.js 618 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. const parsers = require("../parsers");
  3. module.exports.parse = function parse(v) {
  4. const keywords = ["left", "right", "none", "inline-start", "inline-end"];
  5. return parsers.parseKeyword(v, keywords);
  6. };
  7. module.exports.isValid = function isValid(v) {
  8. if (v === "") {
  9. return true;
  10. }
  11. return typeof module.exports.parse(v) === "string";
  12. };
  13. module.exports.definition = {
  14. set(v) {
  15. v = parsers.prepareValue(v, this._global);
  16. this._setProperty("float", module.exports.parse(v));
  17. },
  18. get() {
  19. return this.getPropertyValue("float");
  20. },
  21. enumerable: true,
  22. configurable: true
  23. };