XMLCData.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var NodeType, XMLCData, XMLCharacterData,
  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 = XMLCData = (function(superClass) {
  9. extend(XMLCData, superClass);
  10. function XMLCData(parent, text) {
  11. XMLCData.__super__.constructor.call(this, parent);
  12. if (text == null) {
  13. throw new Error("Missing CDATA text. " + this.debugInfo());
  14. }
  15. this.name = "#cdata-section";
  16. this.type = NodeType.CData;
  17. this.value = this.stringify.cdata(text);
  18. }
  19. XMLCData.prototype.clone = function() {
  20. return Object.create(this);
  21. };
  22. XMLCData.prototype.toString = function(options) {
  23. return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
  24. };
  25. return XMLCData;
  26. })(XMLCharacterData);
  27. }).call(this);