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.

XMLCharacterData.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Generated by CoffeeScript 2.4.1
  2. (function() {
  3. var XMLCharacterData, XMLNode;
  4. XMLNode = require('./XMLNode');
  5. // Represents a character data node
  6. module.exports = XMLCharacterData = (function() {
  7. class XMLCharacterData extends XMLNode {
  8. // Initializes a new instance of `XMLCharacterData`
  9. constructor(parent) {
  10. super(parent);
  11. this.value = '';
  12. }
  13. // Creates and returns a deep clone of `this`
  14. clone() {
  15. return Object.create(this);
  16. }
  17. // DOM level 1 functions to be implemented later
  18. substringData(offset, count) {
  19. throw new Error("This DOM method is not implemented." + this.debugInfo());
  20. }
  21. appendData(arg) {
  22. throw new Error("This DOM method is not implemented." + this.debugInfo());
  23. }
  24. insertData(offset, arg) {
  25. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26. }
  27. deleteData(offset, count) {
  28. throw new Error("This DOM method is not implemented." + this.debugInfo());
  29. }
  30. replaceData(offset, count, arg) {
  31. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32. }
  33. isEqualNode(node) {
  34. if (!super.isEqualNode(node)) {
  35. return false;
  36. }
  37. if (node.data !== this.data) {
  38. return false;
  39. }
  40. return true;
  41. }
  42. };
  43. // DOM level 1
  44. Object.defineProperty(XMLCharacterData.prototype, 'data', {
  45. get: function() {
  46. return this.value;
  47. },
  48. set: function(value) {
  49. return this.value = value || '';
  50. }
  51. });
  52. Object.defineProperty(XMLCharacterData.prototype, 'length', {
  53. get: function() {
  54. return this.value.length;
  55. }
  56. });
  57. // DOM level 3
  58. Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
  59. get: function() {
  60. return this.value;
  61. },
  62. set: function(value) {
  63. return this.value = value || '';
  64. }
  65. });
  66. return XMLCharacterData;
  67. }).call(this);
  68. }).call(this);