attribute.js 1008 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var tslib_1 = require("tslib");
  4. var node_1 = tslib_1.__importDefault(require("./node"));
  5. var Attribute = function (key, op, value) {
  6. this.key = key;
  7. this.op = op;
  8. this.value = value;
  9. };
  10. Attribute.prototype = Object.assign(new node_1.default(), {
  11. type: 'Attribute',
  12. eval: function (context) {
  13. return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);
  14. },
  15. genCSS: function (context, output) {
  16. output.add(this.toCSS(context));
  17. },
  18. toCSS: function (context) {
  19. var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
  20. if (this.op) {
  21. value += this.op;
  22. value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
  23. }
  24. return "[" + value + "]";
  25. }
  26. });
  27. exports.default = Attribute;
  28. //# sourceMappingURL=attribute.js.map