Skip to content
Snippets Groups Projects
index.js 7.57 MiB
Newer Older
  • Learn to ignore specific revisions
  • Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return entry.replace(']]>', ']]]]><![CDATA[>');
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      exports.Builder = (function() {
        function Builder(opts) {
          var key, ref, value;
          this.options = {};
          ref = defaults["0.2"];
          for (key in ref) {
            if (!hasProp.call(ref, key)) continue;
            value = ref[key];
            this.options[key] = value;
          }
          for (key in opts) {
            if (!hasProp.call(opts, key)) continue;
            value = opts[key];
            this.options[key] = value;
          }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
        }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    
        Builder.prototype.buildObject = function(rootObj) {
          var attrkey, charkey, render, rootElement, rootName;
          attrkey = this.options.attrkey;
          charkey = this.options.charkey;
          if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
            rootName = Object.keys(rootObj)[0];
            rootObj = rootObj[rootName];
          } else {
            rootName = this.options.rootName;
          }
          render = (function(_this) {
            return function(element, obj) {
              var attr, child, entry, index, key, value;
              if (typeof obj !== 'object') {
                if (_this.options.cdata && requiresCDATA(obj)) {
                  element.raw(wrapCDATA(obj));
                } else {
                  element.txt(obj);
                }
              } else if (Array.isArray(obj)) {
                for (index in obj) {
                  if (!hasProp.call(obj, index)) continue;
                  child = obj[index];
                  for (key in child) {
                    entry = child[key];
                    element = render(element.ele(key), entry).up();
                  }
                }
              } else {
                for (key in obj) {
                  if (!hasProp.call(obj, key)) continue;
                  child = obj[key];
                  if (key === attrkey) {
                    if (typeof child === "object") {
                      for (attr in child) {
                        value = child[attr];
                        element = element.att(attr, value);
                      }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                    }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
                  } else if (key === charkey) {
                    if (_this.options.cdata && requiresCDATA(child)) {
                      element = element.raw(wrapCDATA(child));
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                    } else {
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
                      element = element.txt(child);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                    }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
                  } else if (Array.isArray(child)) {
                    for (index in child) {
                      if (!hasProp.call(child, index)) continue;
                      entry = child[index];
                      if (typeof entry === 'string') {
                        if (_this.options.cdata && requiresCDATA(entry)) {
                          element = element.ele(key).raw(wrapCDATA(entry)).up();
                        } else {
                          element = element.ele(key, entry).up();
                        }
                      } else {
                        element = render(element.ele(key), entry).up();
                      }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                    }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
                  } else if (typeof child === "object") {
                    element = render(element.ele(key), child).up();
                  } else {
                    if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
                      element = element.ele(key).raw(wrapCDATA(child)).up();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                    } else {
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
                      if (child == null) {
                        child = '';
                      }
                      element = element.ele(key, child.toString()).up();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                    }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
                  }
                }
              }
              return element;
            };
          })(this);
          rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
            headless: this.options.headless,
            allowSurrogateChars: this.options.allowSurrogateChars
          });
          return render(rootElement, rootObj).end(this.options.renderOpts);
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return Builder;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      })();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /* 1516 */
    /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      ref = __webpack_require__(1517), assign = ref.assign, isFunction = ref.isFunction;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDOMImplementation = __webpack_require__(1518);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDocument = __webpack_require__(1519);
    
      XMLDocumentCB = __webpack_require__(1547);
    
      XMLStringWriter = __webpack_require__(1544);
    
      XMLStreamWriter = __webpack_require__(1548);
    
      NodeType = __webpack_require__(1525);
    
      WriterState = __webpack_require__(1546);
    
      module.exports.create = function(name, xmldec, doctype, options) {
        var doc, root;
        if (name == null) {
          throw new Error("Root element needs a name.");
        }
        options = assign({}, xmldec, doctype, options);
        doc = new XMLDocument(options);
        root = doc.element(name);
        if (!options.headless) {
          doc.declaration(options);
          if ((options.pubID != null) || (options.sysID != null)) {
            doc.dtd(options);
          }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
        }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return root;
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.begin = function(options, onData, onEnd) {
        var ref1;
        if (isFunction(options)) {
          ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
          options = {};
        }
        if (onData) {
          return new XMLDocumentCB(options, onData, onEnd);
        } else {
          return new XMLDocument(options);
        }
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.stringWriter = function(options) {
        return new XMLStringWriter(options);
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.streamWriter = function(stream, options) {
        return new XMLStreamWriter(stream, options);
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.implementation = new XMLDOMImplementation();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.nodeType = NodeType;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.writerState = WriterState;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /***/ }),
    /* 1517 */
    /***/ (function(module) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
        slice = [].slice,
        hasProp = {}.hasOwnProperty;
    
      assign = function() {
        var i, key, len, source, sources, target;
        target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
        if (isFunction(Object.assign)) {
          Object.assign.apply(null, arguments);
        } else {
          for (i = 0, len = sources.length; i < len; i++) {
            source = sources[i];
            if (source != null) {
              for (key in source) {
                if (!hasProp.call(source, key)) continue;
                target[key] = source[key];
              }
            }
          }
        }
        return target;
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      isFunction = function(val) {
        return !!val && Object.prototype.toString.call(val) === '[object Function]';
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      isObject = function(val) {
        var ref;
        return !!val && ((ref = typeof val) === 'function' || ref === 'object');
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      isArray = function(val) {
        if (isFunction(Array.isArray)) {
          return Array.isArray(val);
        } else {
          return Object.prototype.toString.call(val) === '[object Array]';
        }
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      isEmpty = function(val) {
        var key;
        if (isArray(val)) {
          return !val.length;
        } else {
          for (key in val) {
            if (!hasProp.call(val, key)) continue;
            return false;
          }
          return true;
        }
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      isPlainObject = function(val) {
        var ctor, proto;
        return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      getValue = function(obj) {
        if (isFunction(obj.valueOf)) {
          return obj.valueOf();
        } else {
          return obj;
        }
      };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.assign = assign;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.isFunction = isFunction;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.isObject = isObject;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.isArray = isArray;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.isEmpty = isEmpty;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.isPlainObject = isPlainObject;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports.getValue = getValue;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /* 1518 */
    /***/ (function(module) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var XMLDOMImplementation;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports = XMLDOMImplementation = (function() {
        function XMLDOMImplementation() {}
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMImplementation.prototype.hasFeature = function(feature, version) {
          return true;
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
          throw new Error("This DOM method is not implemented.");
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
          throw new Error("This DOM method is not implemented.");
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMImplementation.prototype.createHTMLDocument = function(title) {
          throw new Error("This DOM method is not implemented.");
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMImplementation.prototype.getFeature = function(feature, version) {
          throw new Error("This DOM method is not implemented.");
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return XMLDOMImplementation;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      })();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /* 1519 */
    /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
        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; },
        hasProp = {}.hasOwnProperty;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      isPlainObject = (__webpack_require__(1517).isPlainObject);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDOMImplementation = __webpack_require__(1518);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDOMConfiguration = __webpack_require__(1520);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLNode = __webpack_require__(1523);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      NodeType = __webpack_require__(1525);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLStringifier = __webpack_require__(1543);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLStringWriter = __webpack_require__(1544);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports = XMLDocument = (function(superClass) {
        extend(XMLDocument, superClass);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        function XMLDocument(options) {
          XMLDocument.__super__.constructor.call(this, null);
          this.name = "#document";
          this.type = NodeType.Document;
          this.documentURI = null;
          this.domConfig = new XMLDOMConfiguration();
          options || (options = {});
          if (!options.writer) {
            options.writer = new XMLStringWriter();
          }
          this.options = options;
          this.stringify = new XMLStringifier(options);
        }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'implementation', {
          value: new XMLDOMImplementation()
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'doctype', {
          get: function() {
            var child, i, len, ref;
            ref = this.children;
            for (i = 0, len = ref.length; i < len; i++) {
              child = ref[i];
              if (child.type === NodeType.DocType) {
                return child;
              }
            }
            return null;
          }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'documentElement', {
          get: function() {
            return this.rootObject || null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
          get: function() {
            return null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
          get: function() {
            return false;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
          get: function() {
            if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
              return this.children[0].encoding;
            } else {
              return null;
            }
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
          get: function() {
            if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
              return this.children[0].standalone === 'yes';
            } else {
              return false;
            }
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
          get: function() {
            if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
              return this.children[0].version;
            } else {
              return "1.0";
            }
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'URL', {
          get: function() {
            return this.documentURI;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'origin', {
          get: function() {
            return null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'compatMode', {
          get: function() {
            return null;
          }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'characterSet', {
          get: function() {
            return null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDocument.prototype, 'contentType', {
          get: function() {
            return null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.end = function(writer) {
          var writerOptions;
          writerOptions = {};
          if (!writer) {
            writer = this.options.writer;
          } else if (isPlainObject(writer)) {
            writerOptions = writer;
            writer = this.options.writer;
          }
          return writer.document(this, writer.filterOptions(writerOptions));
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.toString = function(options) {
          return this.options.writer.document(this, this.options.writer.filterOptions(options));
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createElement = function(tagName) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createDocumentFragment = function() {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createTextNode = function(data) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createComment = function(data) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createCDATASection = function(data) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createProcessingInstruction = function(target, data) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createAttribute = function(name) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createEntityReference = function(name) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.getElementsByTagName = function(tagname) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.importNode = function(importedNode, deep) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.getElementById = function(elementId) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.adoptNode = function(source) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.normalizeDocument = function() {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.getElementsByClassName = function(classNames) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createEvent = function(eventInterface) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createRange = function() {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) {
          throw new Error("This DOM method is not implemented." + this.debugInfo());
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return XMLDocument;
    
      })(XMLNode);
    
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /* 1520 */
    /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDOMErrorHandler = __webpack_require__(1521);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDOMStringList = __webpack_require__(1522);
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports = XMLDOMConfiguration = (function() {
        function XMLDOMConfiguration() {
          var clonedSelf;
          this.defaultParams = {
            "canonical-form": false,
            "cdata-sections": false,
            "comments": false,
            "datatype-normalization": false,
            "element-content-whitespace": true,
            "entities": true,
            "error-handler": new XMLDOMErrorHandler(),
            "infoset": true,
            "validate-if-schema": false,
            "namespaces": true,
            "namespace-declarations": true,
            "normalize-characters": false,
            "schema-location": '',
            "schema-type": '',
            "split-cdata-sections": true,
            "validate": false,
            "well-formed": true
          };
          this.params = clonedSelf = Object.create(this.defaultParams);
        }
    
        Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
          get: function() {
            return new XMLDOMStringList(Object.keys(this.defaultParams));
          }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMConfiguration.prototype.getParameter = function(name) {
          if (this.params.hasOwnProperty(name)) {
            return this.params[name];
          } else {
            return null;
          }
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
          return true;
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMConfiguration.prototype.setParameter = function(name, value) {
          if (value != null) {
            return this.params[name] = value;
          } else {
            return delete this.params[name];
          }
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return XMLDOMConfiguration;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      })();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /***/ }),
    /* 1521 */
    /***/ (function(module) {
    
    // Generated by CoffeeScript 1.12.7
    (function() {
      var XMLDOMErrorHandler;
    
      module.exports = XMLDOMErrorHandler = (function() {
        function XMLDOMErrorHandler() {}
    
        XMLDOMErrorHandler.prototype.handleError = function(error) {
          throw new Error(error);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        return XMLDOMErrorHandler;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      })();
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /* 1522 */
    /***/ (function(module) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var XMLDOMStringList;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports = XMLDOMStringList = (function() {
        function XMLDOMStringList(arr) {
          this.arr = arr || [];
        }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLDOMStringList.prototype, 'length', {
          get: function() {
            return this.arr.length;
          }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMStringList.prototype.item = function(index) {
          return this.arr[index] || null;
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLDOMStringList.prototype.contains = function(str) {
          return this.arr.indexOf(str) !== -1;
        };
    
        return XMLDOMStringList;
    
      })();
    
    }).call(this);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    /* 1523 */
    /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    // Generated by CoffeeScript 1.12.7
    (function() {
      var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
        hasProp = {}.hasOwnProperty;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      ref1 = __webpack_require__(1517), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLElement = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLCData = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLComment = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDeclaration = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDocType = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLRaw = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLText = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLProcessingInstruction = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLDummy = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      NodeType = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLNodeList = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      XMLNamedNodeMap = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      DocumentPosition = null;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      module.exports = XMLNode = (function() {
        function XMLNode(parent1) {
          this.parent = parent1;
          if (this.parent) {
            this.options = this.parent.options;
            this.stringify = this.parent.stringify;
          }
          this.value = null;
          this.children = [];
          this.baseURI = null;
          if (!XMLElement) {
            XMLElement = __webpack_require__(1524);
            XMLCData = __webpack_require__(1528);
            XMLComment = __webpack_require__(1530);
            XMLDeclaration = __webpack_require__(1531);
            XMLDocType = __webpack_require__(1532);
            XMLRaw = __webpack_require__(1537);
            XMLText = __webpack_require__(1538);
            XMLProcessingInstruction = __webpack_require__(1539);
            XMLDummy = __webpack_require__(1540);
            NodeType = __webpack_require__(1525);
            XMLNodeList = __webpack_require__(1541);
            XMLNamedNodeMap = __webpack_require__(1527);
            DocumentPosition = __webpack_require__(1542);
          }
        }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'nodeName', {
          get: function() {
            return this.name;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'nodeType', {
          get: function() {
            return this.type;
          }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'nodeValue', {
          get: function() {
            return this.value;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'parentNode', {
          get: function() {
            return this.parent;
          }
        });
    
        Object.defineProperty(XMLNode.prototype, 'childNodes', {
          get: function() {
            if (!this.childNodeList || !this.childNodeList.nodes) {
              this.childNodeList = new XMLNodeList(this.children);
            }
            return this.childNodeList;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'firstChild', {
          get: function() {
            return this.children[0] || null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'lastChild', {
          get: function() {
            return this.children[this.children.length - 1] || null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'previousSibling', {
          get: function() {
            var i;
            i = this.parent.children.indexOf(this);
            return this.parent.children[i - 1] || null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'nextSibling', {
          get: function() {
            var i;
            i = this.parent.children.indexOf(this);
            return this.parent.children[i + 1] || null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
          get: function() {
            return this.document() || null;
          }
        });
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        Object.defineProperty(XMLNode.prototype, 'textContent', {
          get: function() {
            var child, j, len, ref2, str;
            if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
              str = '';
              ref2 = this.children;
              for (j = 0, len = ref2.length; j < len; j++) {
                child = ref2[j];
                if (child.textContent) {
                  str += child.textContent;
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
                }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
              }
              return str;
            } else {
              return null;
            }
          },
          set: function(value) {
            throw new Error("This DOM method is not implemented." + this.debugInfo());
          }
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLNode.prototype.setParent = function(parent) {
          var child, j, len, ref2, results;
          this.parent = parent;
          if (parent) {
            this.options = parent.options;
            this.stringify = parent.stringify;
          }
          ref2 = this.children;
          results = [];
          for (j = 0, len = ref2.length; j < len; j++) {
            child = ref2[j];
            results.push(child.setParent(this));
          }
          return results;
        };
    
        XMLNode.prototype.element = function(name, attributes, text) {
          var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
          lastChild = null;
          if (attributes === null && (text == null)) {
            ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
          }
          if (attributes == null) {
            attributes = {};
          }
          attributes = getValue(attributes);
          if (!isObject(attributes)) {
            ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
          }
          if (name != null) {
            name = getValue(name);
          }
          if (Array.isArray(name)) {
            for (j = 0, len = name.length; j < len; j++) {
              item = name[j];
              lastChild = this.element(item);
            }
          } else if (isFunction(name)) {
            lastChild = this.element(name.apply());
          } else if (isObject(name)) {
            for (key in name) {
              if (!hasProp.call(name, key)) continue;
              val = name[key];
              if (isFunction(val)) {
                val = val.apply();
              }
              if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
                lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
              } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
                lastChild = this.dummy();
              } else if (isObject(val) && isEmpty(val)) {
                lastChild = this.element(key);
              } else if (!this.options.keepNullNodes && (val == null)) {
                lastChild = this.dummy();
              } else if (!this.options.separateArrayItems && Array.isArray(val)) {
                for (k = 0, len1 = val.length; k < len1; k++) {
                  item = val[k];
                  childNode = {};
                  childNode[key] = item;
                  lastChild = this.element(childNode);
                }
              } else if (isObject(val)) {
                if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
                  lastChild = this.element(val);
                } else {
                  lastChild = this.element(key);
                  lastChild.element(val);
                }
              } else {
                lastChild = this.element(key, val);
              }
            }
          } else if (!this.options.keepNullNodes && text === null) {
            lastChild = this.dummy();
          } else {
            if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
              lastChild = this.text(text);
            } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
              lastChild = this.cdata(text);
            } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
              lastChild = this.comment(text);
            } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
              lastChild = this.raw(text);
            } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
              lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
            } else {
              lastChild = this.node(name, attributes, text);
            }
          }
          if (lastChild == null) {
            throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
          }
          return lastChild;
        };
    
        XMLNode.prototype.insertBefore = function(name, attributes, text) {
          var child, i, newChild, refChild, removed;
          if (name != null ? name.type : void 0) {
            newChild = name;
            refChild = attributes;
            newChild.setParent(this);
            if (refChild) {
              i = children.indexOf(refChild);
              removed = children.splice(i);
              children.push(newChild);
              Array.prototype.push.apply(children, removed);
            } else {
              children.push(newChild);
            }
            return newChild;
          } else {
            if (this.isRoot) {
              throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
            }
            i = this.parent.children.indexOf(this);
            removed = this.parent.children.splice(i);
            child = this.parent.element(name, attributes, text);
            Array.prototype.push.apply(this.parent.children, removed);
            return child;
          }
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLNode.prototype.insertAfter = function(name, attributes, text) {
          var child, i, removed;
          if (this.isRoot) {
            throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
          }
          i = this.parent.children.indexOf(this);
          removed = this.parent.children.splice(i + 1);
          child = this.parent.element(name, attributes, text);
          Array.prototype.push.apply(this.parent.children, removed);
          return child;
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLNode.prototype.remove = function() {
          var i, ref2;
          if (this.isRoot) {
            throw new Error("Cannot remove the root element. " + this.debugInfo());
          }
          i = this.parent.children.indexOf(this);
          [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
          return this.parent;
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLNode.prototype.node = function(name, attributes, text) {
          var child, ref2;
          if (name != null) {
            name = getValue(name);
          }
          attributes || (attributes = {});
          attributes = getValue(attributes);
          if (!isObject(attributes)) {
            ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
          }
          child = new XMLElement(this, name, attributes);
          if (text != null) {
            child.text(text);
          }
          this.children.push(child);
          return child;
        };
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        XMLNode.prototype.text = function(value) {
          var child;
          if (isObject(value)) {