XMLComment.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var NodeType, XMLCharacterData, XMLComment,
  4. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  5. hasProp = {}.hasOwnProperty;
  6. NodeType = require('./NodeType');
  7. XMLCharacterData = require('./XMLCharacterData');
  8. module.exports = XMLComment = (function(superClass) {
  9. extend(XMLComment, superClass);
  10. function XMLComment(parent, text) {
  11. XMLComment.__super__.constructor.call(this, parent);
  12. if (text == null) {
  13. throw new Error("Missing comment text. " + this.debugInfo());
  14. }
  15. this.name = "#comment";
  16. this.type = NodeType.Comment;
  17. this.value = this.stringify.comment(text);
  18. }
  19. XMLComment.prototype.clone = function() {
  20. return Object.create(this);
  21. };
  22. XMLComment.prototype.toString = function(options) {
  23. return this.options.writer.comment(this, this.options.writer.filterOptions(options));
  24. };
  25. return XMLComment;
  26. })(XMLCharacterData);
  27. }).call(this);