attribute.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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, cif) {
  6. this.key = key;
  7. this.op = op;
  8. this.value = value;
  9. this.cif = cif;
  10. };
  11. Attribute.prototype = Object.assign(new node_1.default(), {
  12. type: 'Attribute',
  13. eval: function (context) {
  14. 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, this.cif);
  15. },
  16. genCSS: function (context, output) {
  17. output.add(this.toCSS(context));
  18. },
  19. toCSS: function (context) {
  20. var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
  21. if (this.op) {
  22. value += this.op;
  23. value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
  24. }
  25. if (this.cif) {
  26. value = value + " " + this.cif;
  27. }
  28. return "[" + value + "]";
  29. }
  30. });
  31. exports.default = Attribute;
  32. //# sourceMappingURL=attribute.js.map