You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XMLProcessingInstruction.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Generated by CoffeeScript 2.4.1
  2. (function() {
  3. var NodeType, XMLCharacterData, XMLProcessingInstruction;
  4. NodeType = require('./NodeType');
  5. XMLCharacterData = require('./XMLCharacterData');
  6. // Represents a processing instruction
  7. module.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData {
  8. // Initializes a new instance of `XMLProcessingInstruction`
  9. // `parent` the parent node
  10. // `target` instruction target
  11. // `value` instruction value
  12. constructor(parent, target, value) {
  13. super(parent);
  14. if (target == null) {
  15. throw new Error("Missing instruction target. " + this.debugInfo());
  16. }
  17. this.type = NodeType.ProcessingInstruction;
  18. this.target = this.stringify.insTarget(target);
  19. this.name = this.target;
  20. if (value) {
  21. this.value = this.stringify.insValue(value);
  22. }
  23. }
  24. // Creates and returns a deep clone of `this`
  25. clone() {
  26. return Object.create(this);
  27. }
  28. // Converts the XML fragment to string
  29. // `options.pretty` pretty prints the result
  30. // `options.indent` indentation for pretty print
  31. // `options.offset` how many indentations to add to every line for pretty print
  32. // `options.newline` newline sequence for pretty print
  33. toString(options) {
  34. return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
  35. }
  36. isEqualNode(node) {
  37. if (!super.isEqualNode(node)) {
  38. return false;
  39. }
  40. if (node.target !== this.target) {
  41. return false;
  42. }
  43. return true;
  44. }
  45. };
  46. }).call(this);