opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 113 kB
JSON
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/xmldom/dom.js","dependencies":[{"path":"/data/node_modules/xmldom/dom.js","mtime":1553611386916},{"path":"/data/.babelrc","mtime":1553611371556},{"path":"/data/node_modules/cache-loader/dist/cjs.js","mtime":1553611387012},{"path":"/data/node_modules/babel-loader/lib/index.js","mtime":1553611386992}],"contextDependencies":[],"result":["'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n/*\n * DOM Level 2\n * Object DOMException\n * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n */\n\nfunction copy(src, dest) {\n\tfor (var p in src) {\n\t\tdest[p] = src[p];\n\t}\n}\n/**\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*((?:.*\\{\\s*?[\\r\\n][\\s\\S]*?^})|\\S.*?(?=[;\\r\\n]));?\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*(\\S.*?(?=[;\\r\\n]));?\n */\nfunction _extends(Class, Super) {\n\tvar pt = Class.prototype;\n\tif (Object.create) {\n\t\tvar ppt = Object.create(Super.prototype);\n\t\tpt.__proto__ = ppt;\n\t}\n\tif (!(pt instanceof Super)) {\n\t\tvar t = function t() {};\n\n\t\t;\n\t\tt.prototype = Super.prototype;\n\t\tt = new t();\n\t\tcopy(pt, t);\n\t\tClass.prototype = pt = t;\n\t}\n\tif (pt.constructor != Class) {\n\t\tif (typeof Class != 'function') {\n\t\t\tconsole.error(\"unknow Class:\" + Class);\n\t\t}\n\t\tpt.constructor = Class;\n\t}\n}\nvar htmlns = 'http://www.w3.org/1999/xhtml';\n// Node Types\nvar NodeType = {};\nvar ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;\nvar ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;\nvar TEXT_NODE = NodeType.TEXT_NODE = 3;\nvar CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;\nvar ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;\nvar ENTITY_NODE = NodeType.ENTITY_NODE = 6;\nvar PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;\nvar COMMENT_NODE = NodeType.COMMENT_NODE = 8;\nvar DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;\nvar DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;\nvar DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;\nvar NOTATION_NODE = NodeType.NOTATION_NODE = 12;\n\n// ExceptionCode\nvar ExceptionCode = {};\nvar ExceptionMessage = {};\nvar INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = \"Index size error\", 1);\nvar DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = \"DOMString size error\", 2);\nvar HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = \"Hierarchy request error\", 3);\nvar WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = \"Wrong document\", 4);\nvar INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = \"Invalid character\", 5);\nvar NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = \"No data allowed\", 6);\nvar NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = \"No modification allowed\", 7);\nvar NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = \"Not found\", 8);\nvar NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = \"Not supported\", 9);\nvar INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = \"Attribute in use\", 10);\n//level2\nvar INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = \"Invalid state\", 11);\nvar SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = \"Syntax error\", 12);\nvar INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = \"Invalid modification\", 13);\nvar NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = \"Invalid namespace\", 14);\nvar INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = \"Invalid access\", 15);\n\nfunction DOMException(code, message) {\n\tif (message instanceof Error) {\n\t\tvar error = message;\n\t} else {\n\t\terror = this;\n\t\tError.call(this, ExceptionMessage[code]);\n\t\tthis.message = ExceptionMessage[code];\n\t\tif (Error.captureStackTrace) Error.captureStackTrace(this, DOMException);\n\t}\n\terror.code = code;\n\tif (message) this.message = this.message + \": \" + message;\n\treturn error;\n};\nDOMException.prototype = Error.prototype;\ncopy(ExceptionCode, DOMException);\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n */\nfunction NodeList() {};\nNodeList.prototype = {\n\t/**\n * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.\n * @standard level1\n */\n\tlength: 0,\n\t/**\n * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.\n * @standard level1\n * @param index unsigned long \n * Index into the collection.\n * @return Node\n * \tThe node at the indexth position in the NodeList, or null if that is not a valid index. \n */\n\titem: function item(index) {\n\t\treturn this[index] || null;\n\t},\n\ttoString: function toString(isHTML, nodeFilter) {\n\t\tfor (var buf = [], i = 0; i < this.length; i++) {\n\t\t\tserializeToString(this[i], buf, isHTML, nodeFilter);\n\t\t}\n\t\treturn buf.join('');\n\t}\n};\nfunction LiveNodeList(node, refresh) {\n\tthis._node = node;\n\tthis._refresh = refresh;\n\t_updateLiveList(this);\n}\nfunction _updateLiveList(list) {\n\tvar inc = list._node._inc || list._node.ownerDocument._inc;\n\tif (list._inc != inc) {\n\t\tvar ls = list._refresh(list._node);\n\t\t//console.log(ls.length)\n\t\t__set__(list, 'length', ls.length);\n\t\tcopy(ls, list);\n\t\tlist._inc = inc;\n\t}\n}\nLiveNodeList.prototype.item = function (i) {\n\t_updateLiveList(this);\n\treturn this[i];\n};\n\n_extends(LiveNodeList, NodeList);\n/**\n * \n * Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.\n * NamedNodeMap objects in the DOM are live.\n * used for attributes or DocumentType entities \n */\nfunction NamedNodeMap() {};\n\nfunction _findNodeIndex(list, node) {\n\tvar i = list.length;\n\twhile (i--) {\n\t\tif (list[i] === node) {\n\t\t\treturn i;\n\t\t}\n\t}\n}\n\nfunction _addNamedNode(el, list, newAttr, oldAttr) {\n\tif (oldAttr) {\n\t\tlist[_findNodeIndex(list, oldAttr)] = newAttr;\n\t} else {\n\t\tlist[list.length++] = newAttr;\n\t}\n\tif (el) {\n\t\tnewAttr.ownerElement = el;\n\t\tvar doc = el.ownerDocument;\n\t\tif (doc) {\n\t\t\toldAttr && _onRemoveAttribute(doc, el, oldAttr);\n\t\t\t_onAddAttribute(doc, el, newAttr);\n\t\t}\n\t}\n}\nfunction _removeNamedNode(el, list, attr) {\n\t//console.log('remove attr:'+attr)\n\tvar i = _findNodeIndex(list, attr);\n\tif (i >= 0) {\n\t\tvar lastIndex = list.length - 1;\n\t\twhile (i < lastIndex) {\n\t\t\tlist[i] = list[++i];\n\t\t}\n\t\tlist.length = lastIndex;\n\t\tif (el) {\n\t\t\tvar doc = el.ownerDocument;\n\t\t\tif (doc) {\n\t\t\t\t_onRemoveAttribute(doc, el, attr);\n\t\t\t\tattr.ownerElement = null;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tthrow DOMException(NOT_FOUND_ERR, new Error(el.tagName + '@' + attr));\n\t}\n}\nNamedNodeMap.prototype = {\n\tlength: 0,\n\titem: NodeList.prototype.item,\n\tgetNamedItem: function getNamedItem(key) {\n\t\t//\t\tif(key.indexOf(':')>0 || key == 'xmlns'){\n\t\t//\t\t\treturn null;\n\t\t//\t\t}\n\t\t//console.log()\n\t\tvar i = this.length;\n\t\twhile (i--) {\n\t\t\tvar attr = this[i];\n\t\t\t//console.log(attr.nodeName,key)\n\t\t\tif (attr.nodeName == key) {\n\t\t\t\treturn attr;\n\t\t\t}\n\t\t}\n\t},\n\tsetNamedItem: function setNamedItem(attr) {\n\t\tvar el = attr.ownerElement;\n\t\tif (el && el != this._ownerElement) {\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\tvar oldAttr = this.getNamedItem(attr.nodeName);\n\t\t_addNamedNode(this._ownerElement, this, attr, oldAttr);\n\t\treturn oldAttr;\n\t},\n\t/* returns Node */\n\tsetNamedItemNS: function setNamedItemNS(attr) {\n\t\t// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR\n\t\tvar el = attr.ownerElement,\n\t\t oldAttr;\n\t\tif (el && el != this._ownerElement) {\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\toldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);\n\t\t_addNamedNode(this._ownerElement, this, attr, oldAttr);\n\t\treturn oldAttr;\n\t},\n\n\t/* returns Node */\n\tremoveNamedItem: function removeNamedItem(key) {\n\t\tvar attr = this.getNamedItem(key);\n\t\t_removeNamedNode(this._ownerElement, this, attr);\n\t\treturn attr;\n\t}, // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR\n\n\t//for level2\n\tremoveNamedItemNS: function removeNamedItemNS(namespaceURI, localName) {\n\t\tvar attr = this.getNamedItemNS(namespaceURI, localName);\n\t\t_removeNamedNode(this._ownerElement, this, attr);\n\t\treturn attr;\n\t},\n\tgetNamedItemNS: function getNamedItemNS(namespaceURI, localName) {\n\t\tvar i = this.length;\n\t\twhile (i--) {\n\t\t\tvar node = this[i];\n\t\t\tif (node.localName == localName && node.namespaceURI == namespaceURI) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n};\n/**\n * @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490\n */\nfunction DOMImplementation( /* Object */features) {\n\tthis._features = {};\n\tif (features) {\n\t\tfor (var feature in features) {\n\t\t\tthis._features = features[feature];\n\t\t}\n\t}\n};\n\nDOMImplementation.prototype = {\n\thasFeature: function hasFeature( /* string */feature, /* string */version) {\n\t\tvar versions = this._features[feature.toLowerCase()];\n\t\tif (versions && (!version || version in versions)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateDocument: function createDocument(namespaceURI, qualifiedName, doctype) {\n\t\t// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR\n\t\tvar doc = new Document();\n\t\tdoc.implementation = this;\n\t\tdoc.childNodes = new NodeList();\n\t\tdoc.doctype = doctype;\n\t\tif (doctype) {\n\t\t\tdoc.appendChild(doctype);\n\t\t}\n\t\tif (qualifiedName) {\n\t\t\tvar root = doc.createElementNS(namespaceURI, qualifiedName);\n\t\t\tdoc.appendChild(root);\n\t\t}\n\t\treturn doc;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateDocumentType: function createDocumentType(qualifiedName, publicId, systemId) {\n\t\t// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR\n\t\tvar node = new DocumentType();\n\t\tnode.name = qualifiedName;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.publicId = publicId;\n\t\tnode.systemId = systemId;\n\t\t// Introduced in DOM Level 2:\n\t\t//readonly attribute DOMString internalSubset;\n\n\t\t//TODO:..\n\t\t// readonly attribute NamedNodeMap entities;\n\t\t// readonly attribute NamedNodeMap notations;\n\t\treturn node;\n\t}\n};\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n */\n\nfunction Node() {};\n\nNode.prototype = {\n\tfirstChild: null,\n\tlastChild: null,\n\tpreviousSibling: null,\n\tnextSibling: null,\n\tattributes: null,\n\tparentNode: null,\n\tchildNodes: null,\n\townerDocument: null,\n\tnodeValue: null,\n\tnamespaceURI: null,\n\tprefix: null,\n\tlocalName: null,\n\t// Modified in DOM Level 2:\n\tinsertBefore: function insertBefore(newChild, refChild) {\n\t\t//raises \n\t\treturn _insertBefore(this, newChild, refChild);\n\t},\n\treplaceChild: function replaceChild(newChild, oldChild) {\n\t\t//raises \n\t\tthis.insertBefore(newChild, oldChild);\n\t\tif (oldChild) {\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t},\n\tremoveChild: function removeChild(oldChild) {\n\t\treturn _removeChild(this, oldChild);\n\t},\n\tappendChild: function appendChild(newChild) {\n\t\treturn this.insertBefore(newChild, null);\n\t},\n\thasChildNodes: function hasChildNodes() {\n\t\treturn this.firstChild != null;\n\t},\n\tcloneNode: function cloneNode(deep) {\n\t\treturn _cloneNode(this.ownerDocument || this, this, deep);\n\t},\n\t// Modified in DOM Level 2:\n\tnormalize: function normalize() {\n\t\tvar child = this.firstChild;\n\t\twhile (child) {\n\t\t\tvar next = child.nextSibling;\n\t\t\tif (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {\n\t\t\t\tthis.removeChild(next);\n\t\t\t\tchild.appendData(next.data);\n\t\t\t} else {\n\t\t\t\tchild.normalize();\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t}\n\t},\n\t// Introduced in DOM Level 2:\n\tisSupported: function isSupported(feature, version) {\n\t\treturn this.ownerDocument.implementation.hasFeature(feature, version);\n\t},\n\t// Introduced in DOM Level 2:\n\thasAttributes: function hasAttributes() {\n\t\treturn this.attributes.length > 0;\n\t},\n\tlookupPrefix: function lookupPrefix(namespaceURI) {\n\t\tvar el = this;\n\t\twhile (el) {\n\t\t\tvar map = el._nsMap;\n\t\t\t//console.dir(map)\n\t\t\tif (map) {\n\t\t\t\tfor (var n in map) {\n\t\t\t\t\tif (map[n] == namespaceURI) {\n\t\t\t\t\t\treturn n;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tel = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n\t\t}\n\t\treturn null;\n\t},\n\t// Introduced in DOM Level 3:\n\tlookupNamespaceURI: function lookupNamespaceURI(prefix) {\n\t\tvar el = this;\n\t\twhile (el) {\n\t\t\tvar map = el._nsMap;\n\t\t\t//console.dir(map)\n\t\t\tif (map) {\n\t\t\t\tif (prefix in map) {\n\t\t\t\t\treturn map[prefix];\n\t\t\t\t}\n\t\t\t}\n\t\t\tel = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n\t\t}\n\t\treturn null;\n\t},\n\t// Introduced in DOM Level 3:\n\tisDefaultNamespace: function isDefaultNamespace(namespaceURI) {\n\t\tvar prefix = this.lookupPrefix(namespaceURI);\n\t\treturn prefix == null;\n\t}\n};\n\nfunction _xmlEncoder(c) {\n\treturn c == '<' && '<' || c == '>' && '>' || c == '&' && '&' || c == '\"' && '"' || '&#' + c.charCodeAt() + ';';\n}\n\ncopy(NodeType, Node);\ncopy(NodeType, Node.prototype);\n\n/**\n * @param callback return true for continue,false for break\n * @return boolean true: break visit;\n */\nfunction _visitNode(node, callback) {\n\tif (callback(node)) {\n\t\treturn true;\n\t}\n\tif (node = node.firstChild) {\n\t\tdo {\n\t\t\tif (_visitNode(node, callback)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} while (node = node.nextSibling);\n\t}\n}\n\nfunction Document() {}\nfunction _onAddAttribute(doc, el, newAttr) {\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI;\n\tif (ns == 'http://www.w3.org/2000/xmlns/') {\n\t\t//update namespace\n\t\tel._nsMap[newAttr.prefix ? newAttr.localName : ''] = newAttr.value;\n\t}\n}\nfunction _onRemoveAttribute(doc, el, newAttr, remove) {\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI;\n\tif (ns == 'http://www.w3.org/2000/xmlns/') {\n\t\t//update namespace\n\t\tdelete el._nsMap[newAttr.prefix ? newAttr.localName : ''];\n\t}\n}\nfunction _onUpdateChild(doc, el, newChild) {\n\tif (doc && doc._inc) {\n\t\tdoc._inc++;\n\t\t//update childNodes\n\t\tvar cs = el.childNodes;\n\t\tif (newChild) {\n\t\t\tcs[cs.length++] = newChild;\n\t\t} else {\n\t\t\t//console.log(1)\n\t\t\tvar child = el.firstChild;\n\t\t\tvar i = 0;\n\t\t\twhile (child) {\n\t\t\t\tcs[i++] = child;\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\tcs.length = i;\n\t\t}\n\t}\n}\n\n/**\n * attributes;\n * children;\n * \n * writeable properties:\n * nodeValue,Attr:value,CharacterData:data\n * prefix\n */\nfunction _removeChild(parentNode, child) {\n\tvar previous = child.previousSibling;\n\tvar next = child.nextSibling;\n\tif (previous) {\n\t\tprevious.nextSibling = next;\n\t} else {\n\t\tparentNode.firstChild = next;\n\t}\n\tif (next) {\n\t\tnext.previousSibling = previous;\n\t} else {\n\t\tparentNode.lastChild = previous;\n\t}\n\t_onUpdateChild(parentNode.ownerDocument, parentNode);\n\treturn child;\n}\n/**\n * preformance key(refChild == null)\n */\nfunction _insertBefore(parentNode, newChild, nextChild) {\n\tvar cp = newChild.parentNode;\n\tif (cp) {\n\t\tcp.removeChild(newChild); //remove and update\n\t}\n\tif (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {\n\t\tvar newFirst = newChild.firstChild;\n\t\tif (newFirst == null) {\n\t\t\treturn newChild;\n\t\t}\n\t\tvar newLast = newChild.lastChild;\n\t} else {\n\t\tnewFirst = newLast = newChild;\n\t}\n\tvar pre = nextChild ? nextChild.previousSibling : parentNode.lastChild;\n\n\tnewFirst.previousSibling = pre;\n\tnewLast.nextSibling = nextChild;\n\n\tif (pre) {\n\t\tpre.nextSibling = newFirst;\n\t} else {\n\t\tparentNode.firstChild = newFirst;\n\t}\n\tif (nextChild == null) {\n\t\tparentNode.lastChild = newLast;\n\t} else {\n\t\tnextChild.previousSibling = newLast;\n\t}\n\tdo {\n\t\tnewFirst.parentNode = parentNode;\n\t} while (newFirst !== newLast && (newFirst = newFirst.nextSibling));\n\t_onUpdateChild(parentNode.ownerDocument || parentNode, parentNode);\n\t//console.log(parentNode.lastChild.nextSibling == null)\n\tif (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\tnewChild.firstChild = newChild.lastChild = null;\n\t}\n\treturn newChild;\n}\nfunction _appendSingleChild(parentNode, newChild) {\n\tvar cp = newChild.parentNode;\n\tif (cp) {\n\t\tvar pre = parentNode.lastChild;\n\t\tcp.removeChild(newChild); //remove and update\n\t\tvar pre = parentNode.lastChild;\n\t}\n\tvar pre = parentNode.lastChild;\n\tnewChild.parentNode = parentNode;\n\tnewChild.previousSibling = pre;\n\tnewChild.nextSibling = null;\n\tif (pre) {\n\t\tpre.nextSibling = newChild;\n\t} else {\n\t\tparentNode.firstChild = newChild;\n\t}\n\tparentNode.lastChild = newChild;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode, newChild);\n\treturn newChild;\n\t//console.log(\"__aa\",parentNode.lastChild.nextSibling == null)\n}\nDocument.prototype = {\n\t//implementation : null,\n\tnodeName: '#document',\n\tnodeType: DOCUMENT_NODE,\n\tdoctype: null,\n\tdocumentElement: null,\n\t_inc: 1,\n\n\tinsertBefore: function insertBefore(newChild, refChild) {\n\t\t//raises \n\t\tif (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\t\tvar child = newChild.firstChild;\n\t\t\twhile (child) {\n\t\t\t\tvar next = child.nextSibling;\n\t\t\t\tthis.insertBefore(child, refChild);\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t\treturn newChild;\n\t\t}\n\t\tif (this.documentElement == null && newChild.nodeType == ELEMENT_NODE) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\n\t\treturn _insertBefore(this, newChild, refChild), newChild.ownerDocument = this, newChild;\n\t},\n\tremoveChild: function removeChild(oldChild) {\n\t\tif (this.documentElement == oldChild) {\n\t\t\tthis.documentElement = null;\n\t\t}\n\t\treturn _removeChild(this, oldChild);\n\t},\n\t// Introduced in DOM Level 2:\n\timportNode: function importNode(importedNode, deep) {\n\t\treturn _importNode(this, importedNode, deep);\n\t},\n\t// Introduced in DOM Level 2:\n\tgetElementById: function getElementById(id) {\n\t\tvar rtv = null;\n\t\t_visitNode(this.documentElement, function (node) {\n\t\t\tif (node.nodeType == ELEMENT_NODE) {\n\t\t\t\tif (node.getAttribute('id') == id) {\n\t\t\t\t\trtv = node;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn rtv;\n\t},\n\n\t//document factory method:\n\tcreateElement: function createElement(tagName) {\n\t\tvar node = new Element();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = tagName;\n\t\tnode.tagName = tagName;\n\t\tnode.childNodes = new NodeList();\n\t\tvar attrs = node.attributes = new NamedNodeMap();\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\tcreateDocumentFragment: function createDocumentFragment() {\n\t\tvar node = new DocumentFragment();\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\treturn node;\n\t},\n\tcreateTextNode: function createTextNode(data) {\n\t\tvar node = new Text();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\tcreateComment: function createComment(data) {\n\t\tvar node = new Comment();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\tcreateCDATASection: function createCDATASection(data) {\n\t\tvar node = new CDATASection();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\tcreateProcessingInstruction: function createProcessingInstruction(target, data) {\n\t\tvar node = new ProcessingInstruction();\n\t\tnode.ownerDocument = this;\n\t\tnode.tagName = node.target = target;\n\t\tnode.nodeValue = node.data = data;\n\t\treturn node;\n\t},\n\tcreateAttribute: function createAttribute(name) {\n\t\tvar node = new Attr();\n\t\tnode.ownerDocument = this;\n\t\tnode.name = name;\n\t\tnode.nodeName = name;\n\t\tnode.localName = name;\n\t\tnode.specified = true;\n\t\treturn node;\n\t},\n\tcreateEntityReference: function createEntityReference(name) {\n\t\tvar node = new EntityReference();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = name;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateElementNS: function createElementNS(namespaceURI, qualifiedName) {\n\t\tvar node = new Element();\n\t\tvar pl = qualifiedName.split(':');\n\t\tvar attrs = node.attributes = new NamedNodeMap();\n\t\tnode.childNodes = new NodeList();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.tagName = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tif (pl.length == 2) {\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t} else {\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateAttributeNS: function createAttributeNS(namespaceURI, qualifiedName) {\n\t\tvar node = new Attr();\n\t\tvar pl = qualifiedName.split(':');\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.name = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tnode.specified = true;\n\t\tif (pl.length == 2) {\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t} else {\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\treturn node;\n\t}\n};\n_extends(Document, Node);\n\nfunction Element() {\n\tthis._nsMap = {};\n};\nElement.prototype = {\n\tnodeType: ELEMENT_NODE,\n\thasAttribute: function hasAttribute(name) {\n\t\treturn this.getAttributeNode(name) != null;\n\t},\n\tgetAttribute: function getAttribute(name) {\n\t\tvar attr = this.getAttributeNode(name);\n\t\treturn attr && attr.value || '';\n\t},\n\tgetAttributeNode: function getAttributeNode(name) {\n\t\treturn this.attributes.getNamedItem(name);\n\t},\n\tsetAttribute: function setAttribute(name, value) {\n\t\tvar attr = this.ownerDocument.createAttribute(name);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr);\n\t},\n\tremoveAttribute: function removeAttribute(name) {\n\t\tvar attr = this.getAttributeNode(name);\n\t\tattr && this.removeAttributeNode(attr);\n\t},\n\n\t//four real opeartion method\n\tappendChild: function appendChild(newChild) {\n\t\tif (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {\n\t\t\treturn this.insertBefore(newChild, null);\n\t\t} else {\n\t\t\treturn _appendSingleChild(this, newChild);\n\t\t}\n\t},\n\tsetAttributeNode: function setAttributeNode(newAttr) {\n\t\treturn this.attributes.setNamedItem(newAttr);\n\t},\n\tsetAttributeNodeNS: function setAttributeNodeNS(newAttr) {\n\t\treturn this.attributes.setNamedItemNS(newAttr);\n\t},\n\tremoveAttributeNode: function removeAttributeNode(oldAttr) {\n\t\t//console.log(this == oldAttr.ownerElement)\n\t\treturn this.attributes.removeNamedItem(oldAttr.nodeName);\n\t},\n\t//get real attribute name,and remove it by removeAttributeNode\n\tremoveAttributeNS: function removeAttributeNS(namespaceURI, localName) {\n\t\tvar old = this.getAttributeNodeNS(namespaceURI, localName);\n\t\told && this.removeAttributeNode(old);\n\t},\n\n\thasAttributeNS: function hasAttributeNS(namespaceURI, localName) {\n\t\treturn this.getAttributeNodeNS(namespaceURI, localName) != null;\n\t},\n\tgetAttributeNS: function getAttributeNS(namespaceURI, localName) {\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\treturn attr && attr.value || '';\n\t},\n\tsetAttributeNS: function setAttributeNS(namespaceURI, qualifiedName, value) {\n\t\tvar attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr);\n\t},\n\tgetAttributeNodeNS: function getAttributeNodeNS(namespaceURI, localName) {\n\t\treturn this.attributes.getNamedItemNS(namespaceURI, localName);\n\t},\n\n\tgetElementsByTagName: function getElementsByTagName(tagName) {\n\t\treturn new LiveNodeList(this, function (base) {\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base, function (node) {\n\t\t\t\tif (node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)) {\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\t\t});\n\t},\n\tgetElementsByTagNameNS: function getElementsByTagNameNS(namespaceURI, localName) {\n\t\treturn new LiveNodeList(this, function (base) {\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base, function (node) {\n\t\t\t\tif (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)) {\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\t\t});\n\t}\n};\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n\n_extends(Element, Node);\nfunction Attr() {};\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr, Node);\n\nfunction CharacterData() {};\nCharacterData.prototype = {\n\tdata: '',\n\tsubstringData: function substringData(offset, count) {\n\t\treturn this.data.substring(offset, offset + count);\n\t},\n\tappendData: function appendData(text) {\n\t\ttext = this.data + text;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t},\n\tinsertData: function insertData(offset, text) {\n\t\tthis.replaceData(offset, 0, text);\n\t},\n\tappendChild: function appendChild(newChild) {\n\t\tthrow new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);\n\t},\n\tdeleteData: function deleteData(offset, count) {\n\t\tthis.replaceData(offset, count, \"\");\n\t},\n\treplaceData: function replaceData(offset, count, text) {\n\t\tvar start = this.data.substring(0, offset);\n\t\tvar end = this.data.substring(offset + count);\n\t\ttext = start + text + end;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t}\n};\n_extends(CharacterData, Node);\nfunction Text() {};\nText.prototype = {\n\tnodeName: \"#text\",\n\tnodeType: TEXT_NODE,\n\tsplitText: function splitText(offset) {\n\t\tvar text = this.data;\n\t\tvar newText = text.substring(offset);\n\t\ttext = text.substring(0, offset);\n\t\tthis.data = this.nodeValue = text;\n\t\tthis.length = text.length;\n\t\tvar newNode = this.ownerDocument.createTextNode(newText);\n\t\tif (this.parentNode) {\n\t\t\tthis.parentNode.insertBefore(newNode, this.nextSibling);\n\t\t}\n\t\treturn newNode;\n\t}\n};\n_extends(Text, CharacterData);\nfunction Comment() {};\nComment.prototype = {\n\tnodeName: \"#comment\",\n\tnodeType: COMMENT_NODE\n};\n_extends(Comment, CharacterData);\n\nfunction CDATASection() {};\nCDATASection.prototype = {\n\tnodeName: \"#cdata-section\",\n\tnodeType: CDATA_SECTION_NODE\n};\n_extends(CDATASection, CharacterData);\n\nfunction DocumentType() {};\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType, Node);\n\nfunction Notation() {};\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation, Node);\n\nfunction Entity() {};\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity, Node);\n\nfunction EntityReference() {};\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference, Node);\n\nfunction DocumentFragment() {};\nDocumentFragment.prototype.nodeName = \"#document-fragment\";\nDocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment, Node);\n\nfunction ProcessingInstruction() {}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction, Node);\nfunction XMLSerializer() {}\nXMLSerializer.prototype.serializeToString = function (node, isHtml, nodeFilter) {\n\treturn nodeSerializeToString.call(node, isHtml, nodeFilter);\n};\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(isHtml, nodeFilter) {\n\tvar buf = [];\n\tvar refNode = this.nodeType == 9 ? this.documentElement : this;\n\tvar prefix = refNode.prefix;\n\tvar uri = refNode.namespaceURI;\n\n\tif (uri && prefix == null) {\n\t\t//console.log(prefix)\n\t\tvar prefix = refNode.lookupPrefix(uri);\n\t\tif (prefix == null) {\n\t\t\t//isHTML = true;\n\t\t\tvar visibleNamespaces = [{ namespace: uri, prefix: null\n\t\t\t\t//{namespace:uri,prefix:''}\n\t\t\t}];\n\t\t}\n\t}\n\tserializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);\n\t//console.log('###',this.nodeType,uri,prefix,buf.join(''))\n\treturn buf.join('');\n}\nfunction needNamespaceDefine(node, isHTML, visibleNamespaces) {\n\tvar prefix = node.prefix || '';\n\tvar uri = node.namespaceURI;\n\tif (!prefix && !uri) {\n\t\treturn false;\n\t}\n\tif (prefix === \"xml\" && uri === \"http://www.w3.org/XML/1998/namespace\" || uri == 'http://www.w3.org/2000/xmlns/') {\n\t\treturn false;\n\t}\n\n\tvar i = visibleNamespaces.length;\n\t//console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces)\n\twhile (i--) {\n\t\tvar ns = visibleNamespaces[i];\n\t\t// get namespace prefix\n\t\t//console.log(node.nodeType,node.tagName,ns.prefix,prefix)\n\t\tif (ns.prefix == prefix) {\n\t\t\treturn ns.namespace != uri;\n\t\t}\n\t}\n\t//console.log(isHTML,uri,prefix=='')\n\t//if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){\n\t//\treturn false;\n\t//}\n\t//node.flag = '11111'\n\t//console.error(3,true,node.flag,node.prefix,node.namespaceURI)\n\treturn true;\n}\nfunction serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {\n\tif (nodeFilter) {\n\t\tnode = nodeFilter(node);\n\t\tif (node) {\n\t\t\tif (typeof node == 'string') {\n\t\t\t\tbuf.push(node);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t\t//buf.sort.apply(attrs, attributeSorter);\n\t}\n\tswitch (node.nodeType) {\n\t\tcase ELEMENT_NODE:\n\t\t\tif (!visibleNamespaces) visibleNamespaces = [];\n\t\t\tvar startVisibleNamespaces = visibleNamespaces.length;\n\t\t\tvar attrs = node.attributes;\n\t\t\tvar len = attrs.length;\n\t\t\tvar child = node.firstChild;\n\t\t\tvar nodeName = node.tagName;\n\n\t\t\tisHTML = htmlns === node.namespaceURI || isHTML;\n\t\t\tbuf.push('<', nodeName);\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\t// add namespaces for attributes\n\t\t\t\tvar attr = attrs.item(i);\n\t\t\t\tif (attr.prefix == 'xmlns') {\n\t\t\t\t\tvisibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });\n\t\t\t\t} else if (attr.nodeName == 'xmlns') {\n\t\t\t\t\tvisibleNamespaces.push({ prefix: '', namespace: attr.value });\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar attr = attrs.item(i);\n\t\t\t\tif (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {\n\t\t\t\t\tvar prefix = attr.prefix || '';\n\t\t\t\t\tvar uri = attr.namespaceURI;\n\t\t\t\t\tvar ns = prefix ? ' xmlns:' + prefix : \" xmlns\";\n\t\t\t\t\tbuf.push(ns, '=\"', uri, '\"');\n\t\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace: uri });\n\t\t\t\t}\n\t\t\t\tserializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);\n\t\t\t}\n\t\t\t// add namespace for current node\t\t\n\t\t\tif (needNamespaceDefine(node, isHTML, visibleNamespaces)) {\n\t\t\t\tvar prefix = node.prefix || '';\n\t\t\t\tvar uri = node.namespaceURI;\n\t\t\t\tvar ns = prefix ? ' xmlns:' + prefix : \" xmlns\";\n\t\t\t\tbuf.push(ns, '=\"', uri, '\"');\n\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace: uri });\n\t\t\t}\n\n\t\t\tif (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {\n\t\t\t\tbuf.push('>');\n\t\t\t\t//if is cdata child node\n\t\t\t\tif (isHTML && /^script$/i.test(nodeName)) {\n\t\t\t\t\twhile (child) {\n\t\t\t\t\t\tif (child.data) {\n\t\t\t\t\t\t\tbuf.push(child.data);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twhile (child) {\n\t\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces);\n\t\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuf.push('</', nodeName, '>');\n\t\t\t} else {\n\t\t\t\tbuf.push('/>');\n\t\t\t}\n\t\t\t// remove added visible namespaces\n\t\t\t//visibleNamespaces.length = startVisibleNamespaces;\n\t\t\treturn;\n\t\tcase DOCUMENT_NODE:\n\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\tvar child = node.firstChild;\n\t\t\twhile (child) {\n\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces);\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\treturn;\n\t\tcase ATTRIBUTE_NODE:\n\t\t\treturn buf.push(' ', node.name, '=\"', node.value.replace(/[<&\"]/g, _xmlEncoder), '\"');\n\t\tcase TEXT_NODE:\n\t\t\treturn buf.push(node.data.replace(/[<&]/g, _xmlEncoder));\n\t\tcase CDATA_SECTION_NODE:\n\t\t\treturn buf.push('<![CDATA[', node.data, ']]>');\n\t\tcase COMMENT_NODE:\n\t\t\treturn buf.push(\"<!--\", node.data, \"-->\");\n\t\tcase DOCUMENT_TYPE_NODE:\n\t\t\tvar pubid = node.publicId;\n\t\t\tvar sysid = node.systemId;\n\t\t\tbuf.push('<!DOCTYPE ', node.name);\n\t\t\tif (pubid) {\n\t\t\t\tbuf.push(' PUBLIC \"', pubid);\n\t\t\t\tif (sysid && sysid != '.') {\n\t\t\t\t\tbuf.push('\" \"', sysid);\n\t\t\t\t}\n\t\t\t\tbuf.push('\">');\n\t\t\t} else if (sysid && sysid != '.') {\n\t\t\t\tbuf.push(' SYSTEM \"', sysid, '\">');\n\t\t\t} else {\n\t\t\t\tvar sub = node.internalSubset;\n\t\t\t\tif (sub) {\n\t\t\t\t\tbuf.push(\" [\", sub, \"]\");\n\t\t\t\t}\n\t\t\t\tbuf.push(\">\");\n\t\t\t}\n\t\t\treturn;\n\t\tcase PROCESSING_INSTRUCTION_NODE:\n\t\t\treturn buf.push(\"<?\", node.target, \" \", node.data, \"?>\");\n\t\tcase ENTITY_REFERENCE_NODE:\n\t\t\treturn buf.push('&', node.nodeName, ';');\n\t\t//case ENTITY_NODE:\n\t\t//case NOTATION_NODE:\n\t\tdefault:\n\t\t\tbuf.push('??', node.nodeName);\n\t}\n}\nfunction _importNode(doc, node, deep) {\n\tvar node2;\n\tswitch (node.nodeType) {\n\t\tcase ELEMENT_NODE:\n\t\t\tnode2 = node.cloneNode(false);\n\t\t\tnode2.ownerDocument = doc;\n\t\t//var attrs = node2.attributes;\n\t\t//var len = attrs.length;\n\t\t//for(var i=0;i<len;i++){\n\t\t//node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));\n\t\t//}\n\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\tbreak;\n\t\tcase ATTRIBUTE_NODE:\n\t\t\tdeep = true;\n\t\t\tbreak;\n\t\t//case ENTITY_REFERENCE_NODE:\n\t\t//case PROCESSING_INSTRUCTION_NODE:\n\t\t////case TEXT_NODE:\n\t\t//case CDATA_SECTION_NODE:\n\t\t//case COMMENT_NODE:\n\t\t//\tdeep = false;\n\t\t//\tbreak;\n\t\t//case DOCUMENT_NODE:\n\t\t//case DOCUMENT_TYPE_NODE:\n\t\t//cannot be imported.\n\t\t//case ENTITY_NODE:\n\t\t//case NOTATION_NODE:\n\t\t//can not hit in level3\n\t\t//default:throw e;\n\t}\n\tif (!node2) {\n\t\tnode2 = node.cloneNode(false); //false\n\t}\n\tnode2.ownerDocument = doc;\n\tnode2.parentNode = null;\n\tif (deep) {\n\t\tvar child = node.firstChild;\n\t\twhile (child) {\n\t\t\tnode2.appendChild(_importNode(doc, child, deep));\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t}\n\treturn node2;\n}\n//\n//var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,\n//\t\t\t\t\tattributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};\nfunction _cloneNode(doc, node, deep) {\n\tvar node2 = new node.constructor();\n\tfor (var n in node) {\n\t\tvar v = node[n];\n\t\tif ((typeof v === 'undefined' ? 'undefined' : _typeof(v)) != 'object') {\n\t\t\tif (v != node2[n]) {\n\t\t\t\tnode2[n] = v;\n\t\t\t}\n\t\t}\n\t}\n\tif (node.childNodes) {\n\t\tnode2.childNodes = new NodeList();\n\t}\n\tnode2.ownerDocument = doc;\n\tswitch (node2.nodeType) {\n\t\tcase ELEMENT_NODE:\n\t\t\tvar attrs = node.attributes;\n\t\t\tvar attrs2 = node2.attributes = new NamedNodeMap();\n\t\t\tvar len = attrs.length;\n\t\t\tattrs2._ownerElement = node2;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tnode2.setAttributeNode(_cloneNode(doc, attrs.item(i), true));\n\t\t\t}\n\t\t\tbreak;;\n\t\tcase ATTRIBUTE_NODE:\n\t\t\tdeep = true;\n\t}\n\tif (deep) {\n\t\tvar child = node.firstChild;\n\t\twhile (child) {\n\t\t\tnode2.appendChild(_cloneNode(doc, child, deep));\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t}\n\treturn node2;\n}\n\nfunction __set__(object, key, value) {\n\tobject[key] = value;\n}\n//do dynamic\ntry {\n\tif (Object.defineProperty) {\n\t\tvar getTextContent = function getTextContent(node) {\n\t\t\tswitch (node.nodeType) {\n\t\t\t\tcase ELEMENT_NODE:\n\t\t\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\t\t\tvar buf = [];\n\t\t\t\t\tnode = node.firstChild;\n\t\t\t\t\twhile (node) {\n\t\t\t\t\t\tif (node.nodeType !== 7 && node.nodeType !== 8) {\n\t\t\t\t\t\t\tbuf.push(getTextContent(node));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnode = node.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t\treturn buf.join('');\n\t\t\t\tdefault:\n\t\t\t\t\treturn node.nodeValue;\n\t\t\t}\n\t\t};\n\n\t\tObject.defineProperty(LiveNodeList.prototype, 'length', {\n\t\t\tget: function get() {\n\t\t\t\t_updateLiveList(this);\n\t\t\t\treturn this.$$length;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(Node.prototype, 'textContent', {\n\t\t\tget: function get() {\n\t\t\t\treturn getTextContent(this);\n\t\t\t},\n\t\t\tset: function set(data) {\n\t\t\t\tswitch (this.nodeType) {\n\t\t\t\t\tcase ELEMENT_NODE:\n\t\t\t\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\t\t\t\twhile (this.firstChild) {\n\t\t\t\t\t\t\tthis.removeChild(this.firstChild);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (data || String(data)) {\n\t\t\t\t\t\t\tthis.appendChild(this.ownerDocument.createTextNode(data));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t//TODO:\n\t\t\t\t\t\tthis.data = data;\n\t\t\t\t\t\tthis.value = data;\n\t\t\t\t\t\tthis.nodeValue = data;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t__set__ = function __set__(object, key, value) {\n\t\t\t//console.log(value)\n\t\t\tobject['$$' + key] = value;\n\t\t};\n\t}\n} catch (e) {} //ie8\n\n\n//if(typeof require == 'function'){\nexports.DOMImplementation = DOMImplementation;\nexports.XMLSerializer = XMLSerializer;\n//}",{"version":3,"sources":["node_modules/xmldom/dom.js"],"names":["copy","src","dest","p","_extends","Class","Super","pt","prototype","Object","create","ppt","__proto__","t","constructor","console","error","htmlns","NodeType","ELEMENT_NODE","ATTRIBUTE_NODE","TEXT_NODE","CDATA_SECTION_NODE","ENTITY_REFERENCE_NODE","ENTITY_NODE","PROCESSING_INSTRUCTION_NODE","COMMENT_NODE","DOCUMENT_NODE","DOCUMENT_TYPE_NODE","DOCUMENT_FRAGMENT_NODE","NOTATION_NODE","ExceptionCode","ExceptionMessage","INDEX_SIZE_ERR","DOMSTRING_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR","NO_DATA_ALLOWED_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR","DOMException","code","message","Error","call","captureStackTrace","NodeList","length","item","index","toString","isHTML","nodeFilter","buf","i","serializeToString","join","LiveNodeList","node","refresh","_node","_refresh","_updateLiveList","list","inc","_inc","ownerDocument","ls","__set__","NamedNodeMap","_findNodeIndex","_addNamedNode","el","newAttr","oldAttr","ownerElement","doc","_onRemoveAttribute","_onAddAttribute","_removeNamedNode","attr","lastIndex","tagName","getNamedItem","key","nodeName","setNamedItem","_ownerElement","setNamedItemNS","getNamedItemNS","namespaceURI","localName","removeNamedItem","removeNamedItemNS","DOMImplementation","features","_features","feature","hasFeature","version","versions","toLowerCase","createDocument","qualifiedName","doctype","Document","implementation","childNodes","appendChild","root","createElementNS","createDocumentType","publicId","systemId","DocumentType","name","Node","firstChild","lastChild","previousSibling","nextSibling","attributes","parentNode","nodeValue","prefix","insertBefore","newChild","refChild","_insertBefore","replaceChild","oldChild","removeChild","_removeChild","hasChildNodes","cloneNode","deep","normalize","child","next","nodeType","appendData","data","isSupported","hasAttributes","lookupPrefix","map","_nsMap","n","lookupNamespaceURI","isDefaultNamespace","_xmlEncoder","c","charCodeAt","_visitNode","callback","ns","value","remove","_onUpdateChild","cs","previous","nextChild","cp","newFirst","newLast","pre","_appendSingleChild","documentElement","importNode","importedNode","getElementById","id","rtv","getAttribute","createElement","Element","attrs","createDocumentFragment","DocumentFragment","createTextNode","Text","createComment","Comment","createCDATASection","CDATASection","createProcessingInstruction","target","ProcessingInstruction","createAttribute","Attr","specified","createEntityReference","EntityReference","pl","split","createAttributeNS","hasAttribute","getAttributeNode","setAttribute","setAttributeNode","removeAttribute","removeAttributeNode","setAttributeNodeNS","removeAttributeNS","old","getAttributeNodeNS","hasAttributeNS","getAttributeNS","setAttributeNS","getElementsByTagName","base","push","getElementsByTagNameNS","CharacterData","substringData","offset","count","substring","text","insertData","replaceData","deleteData","start","end","splitText","newText","newNode","Notation","Entity","XMLSerializer","isHtml","nodeSerializeToString","refNode","uri","visibleNamespaces","namespace","needNamespaceDefine","startVisibleNamespaces","len","test","replace","pubid","sysid","sub","internalSubset","node2","v","attrs2","object","defineProperty","getTextContent","get","$$length","set","String","e","exports"],"mappings":";;;;AAAA;;;;;;;AAOA,SAASA,IAAT,CAAcC,GAAd,EAAkBC,IAAlB,EAAuB;AACtB,MAAI,IAAIC,CAAR,IAAaF,GAAb,EAAiB;AAChBC,OAAKC,CAAL,IAAUF,IAAIE,CAAJ,CAAV;AACA;AACD;AACD;;;;AAIA,SAASC,QAAT,CAAkBC,KAAlB,EAAwBC,KAAxB,EAA8B;AAC7B,KAAIC,KAAKF,MAAMG,SAAf;AACA,KAAGC,OAAOC,MAAV,EAAiB;AAChB,MAAIC,MAAMF,OAAOC,MAAP,CAAcJ,MAAME,SAApB,CAAV;AACAD,KAAGK,SAAH,GAAeD,GAAf;AACA;AACD,KAAG,EAAEJ,cAAcD,KAAhB,CAAH,EAA0B;AAAA,MAChBO,CADgB,GACzB,aAAY,CAAE,CADW;;AACX;AACdA,IAAEL,SAAF,GAAcF,MAAME,SAApB;AACAK,MAAI,IAAIA,CAAJ,EAAJ;AACAb,OAAKO,EAAL,EAAQM,CAAR;AACAR,QAAMG,SAAN,GAAkBD,KAAKM,CAAvB;AACA;AACD,KAAGN,GAAGO,WAAH,IAAkBT,KAArB,EAA2B;AAC1B,MAAG,OAAOA,KAAP,IAAgB,UAAnB,EAA8B;AAC7BU,WAAQC,KAAR,CAAc,kBAAgBX,KAA9B;AACA;AACDE,KAAGO,WAAH,GAAiBT,KAAjB;AACA;AACD;AACD,IAAIY,SAAS,8BAAb;AACA;AACA,IAAIC,WAAW,EAAf;AACA,IAAIC,eAA8BD,SAASC,YAAT,GAAuC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