XMLNodeList.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Generated by CoffeeScript 2.4.1
  2. (function() {
  3. // Represents a list of nodes
  4. var XMLNodeList;
  5. module.exports = XMLNodeList = (function() {
  6. class XMLNodeList {
  7. // Initializes a new instance of `XMLNodeList`
  8. // This is just a wrapper around an ordinary
  9. // JS array.
  10. // `nodes` the array containing nodes.
  11. constructor(nodes) {
  12. this.nodes = nodes;
  13. }
  14. // Creates and returns a deep clone of `this`
  15. clone() {
  16. // this class should not be cloned since it wraps
  17. // around a given array. The calling function should check
  18. // whether the wrapped array is null and supply a new array
  19. // (from the clone).
  20. return this.nodes = null;
  21. }
  22. // DOM Level 1
  23. item(index) {
  24. return this.nodes[index] || null;
  25. }
  26. };
  27. // DOM level 1
  28. Object.defineProperty(XMLNodeList.prototype, 'length', {
  29. get: function() {
  30. return this.nodes.length || 0;
  31. }
  32. });
  33. return XMLNodeList;
  34. }).call(this);
  35. }).call(this);