comment.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. var __importDefault = (this && this.__importDefault) || function (mod) {
  18. return (mod && mod.__esModule) ? mod : { "default": mod };
  19. };
  20. Object.defineProperty(exports, "__esModule", { value: true });
  21. var node_1 = __importDefault(require("./node"));
  22. var type_1 = __importDefault(require("./type"));
  23. var CommentNode = /** @class */ (function (_super) {
  24. __extends(CommentNode, _super);
  25. function CommentNode(rawText, parentNode) {
  26. var _this = _super.call(this, parentNode) || this;
  27. _this.rawText = rawText;
  28. /**
  29. * Node Type declaration.
  30. * @type {Number}
  31. */
  32. _this.nodeType = type_1.default.COMMENT_NODE;
  33. return _this;
  34. }
  35. Object.defineProperty(CommentNode.prototype, "text", {
  36. /**
  37. * Get unescaped text value of current node and its children.
  38. * @return {string} text content
  39. */
  40. get: function () {
  41. return this.rawText;
  42. },
  43. enumerable: false,
  44. configurable: true
  45. });
  46. CommentNode.prototype.toString = function () {
  47. return "<!--" + this.rawText + "-->";
  48. };
  49. return CommentNode;
  50. }(node_1.default));
  51. exports.default = CommentNode;