XMLRaw.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var NodeType, XMLNode, XMLRaw,
  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. XMLNode = require('./XMLNode');
  8. module.exports = XMLRaw = (function(superClass) {
  9. extend(XMLRaw, superClass);
  10. function XMLRaw(parent, text) {
  11. XMLRaw.__super__.constructor.call(this, parent);
  12. if (text == null) {
  13. throw new Error("Missing raw text. " + this.debugInfo());
  14. }
  15. this.type = NodeType.Raw;
  16. this.value = this.stringify.raw(text);
  17. }
  18. XMLRaw.prototype.clone = function() {
  19. return Object.create(this);
  20. };
  21. XMLRaw.prototype.toString = function(options) {
  22. return this.options.writer.raw(this, this.options.writer.filterOptions(options));
  23. };
  24. return XMLRaw;
  25. })(XMLNode);
  26. }).call(this);