XMLProcessingInstruction.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var NodeType, XMLCharacterData, XMLProcessingInstruction,
  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 = XMLProcessingInstruction = (function(superClass) {
  9. extend(XMLProcessingInstruction, superClass);
  10. function XMLProcessingInstruction(parent, target, value) {
  11. XMLProcessingInstruction.__super__.constructor.call(this, parent);
  12. if (target == null) {
  13. throw new Error("Missing instruction target. " + this.debugInfo());
  14. }
  15. this.type = NodeType.ProcessingInstruction;
  16. this.target = this.stringify.insTarget(target);
  17. this.name = this.target;
  18. if (value) {
  19. this.value = this.stringify.insValue(value);
  20. }
  21. }
  22. XMLProcessingInstruction.prototype.clone = function() {
  23. return Object.create(this);
  24. };
  25. XMLProcessingInstruction.prototype.toString = function(options) {
  26. return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
  27. };
  28. XMLProcessingInstruction.prototype.isEqualNode = function(node) {
  29. if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  30. return false;
  31. }
  32. if (node.target !== this.target) {
  33. return false;
  34. }
  35. return true;
  36. };
  37. return XMLProcessingInstruction;
  38. })(XMLCharacterData);
  39. }).call(this);