initial commit
This commit is contained in:
@@ -0,0 +1,932 @@
|
||||
shadow$provide.module$node_modules$$xmldom$xmldom$lib$dom = function(global, require, module, exports) {
|
||||
function notEmptyString(input) {
|
||||
return "" !== input;
|
||||
}
|
||||
function orderedSetReducer(current, element) {
|
||||
current.hasOwnProperty(element) || (current[element] = !0);
|
||||
return current;
|
||||
}
|
||||
function toOrderedSet(input) {
|
||||
if (!input) {
|
||||
return [];
|
||||
}
|
||||
input = input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
|
||||
return Object.keys(input.reduce(orderedSetReducer, {}));
|
||||
}
|
||||
function arrayIncludes(list) {
|
||||
return function(element) {
|
||||
return list && -1 !== list.indexOf(element);
|
||||
};
|
||||
}
|
||||
function copy(src, dest) {
|
||||
for (var p in src) {
|
||||
Object.prototype.hasOwnProperty.call(src, p) && (dest[p] = src[p]);
|
||||
}
|
||||
}
|
||||
function _extends(Class, Super) {
|
||||
var pt = Class.prototype;
|
||||
if (!(pt instanceof Super)) {
|
||||
function t() {
|
||||
}
|
||||
t.prototype = Super.prototype;
|
||||
t = new t();
|
||||
copy(pt, t);
|
||||
Class.prototype = pt = t;
|
||||
}
|
||||
pt.constructor != Class && ("function" != typeof Class && console.error("unknown Class:" + Class), pt.constructor = Class);
|
||||
}
|
||||
function DOMException(code, message) {
|
||||
if (message instanceof Error) {
|
||||
var error = message;
|
||||
} else {
|
||||
error = this, Error.call(this, ExceptionMessage[code]), this.message = ExceptionMessage[code], Error.captureStackTrace && Error.captureStackTrace(this, DOMException);
|
||||
}
|
||||
error.code = code;
|
||||
message && (this.message = this.message + ": " + message);
|
||||
return error;
|
||||
}
|
||||
function NodeList() {
|
||||
}
|
||||
function LiveNodeList(node, refresh) {
|
||||
this._node = node;
|
||||
this._refresh = refresh;
|
||||
_updateLiveList(this);
|
||||
}
|
||||
function _updateLiveList(list) {
|
||||
var inc = list._node._inc || list._node.ownerDocument._inc;
|
||||
if (list._inc !== inc) {
|
||||
var ls = list._refresh(list._node);
|
||||
__set__(list, "length", ls.length);
|
||||
if (!list.$$length || ls.length < list.$$length) {
|
||||
for (var i = ls.length; i in list; i++) {
|
||||
Object.prototype.hasOwnProperty.call(list, i) && delete list[i];
|
||||
}
|
||||
}
|
||||
copy(ls, list);
|
||||
list._inc = inc;
|
||||
}
|
||||
}
|
||||
function NamedNodeMap() {
|
||||
}
|
||||
function _findNodeIndex(list, node) {
|
||||
for (var i = list.length; i--;) {
|
||||
if (list[i] === node) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
function _addNamedNode(el, list, newAttr, oldAttr) {
|
||||
oldAttr ? list[_findNodeIndex(list, oldAttr)] = newAttr : list[list.length++] = newAttr;
|
||||
el && (newAttr.ownerElement = el, list = el.ownerDocument) && (oldAttr && (list && list._inc++, oldAttr.namespaceURI === NAMESPACE.XMLNS && delete el._nsMap[oldAttr.prefix ? oldAttr.localName : ""]), list && list._inc++, newAttr.namespaceURI === NAMESPACE.XMLNS && (el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value));
|
||||
}
|
||||
function _removeNamedNode(el, list, attr) {
|
||||
var i = _findNodeIndex(list, attr);
|
||||
if (0 <= i) {
|
||||
for (var lastIndex = list.length - 1; i < lastIndex;) {
|
||||
list[i] = list[++i];
|
||||
}
|
||||
list.length = lastIndex;
|
||||
el && (list = el.ownerDocument) && (list && list._inc++, attr.namespaceURI === NAMESPACE.XMLNS && delete el._nsMap[attr.prefix ? attr.localName : ""], attr.ownerElement = null);
|
||||
} else {
|
||||
throw new DOMException(NOT_FOUND_ERR, Error(el.tagName + "@" + attr));
|
||||
}
|
||||
}
|
||||
function DOMImplementation() {
|
||||
}
|
||||
function Node() {
|
||||
}
|
||||
function _xmlEncoder(c) {
|
||||
return "\x3c" == c && "\x26lt;" || "\x3e" == c && "\x26gt;" || "\x26" == c && "\x26amp;" || '"' == c && "\x26quot;" || "\x26#" + c.charCodeAt() + ";";
|
||||
}
|
||||
function _visitNode(node, callback) {
|
||||
return walkDOM(node, null, {enter:function(n) {
|
||||
return callback(n) ? walkDOM.STOP : !0;
|
||||
}}) === walkDOM.STOP;
|
||||
}
|
||||
function walkDOM(node, context, callbacks) {
|
||||
for (node = [{node, context, phase:walkDOM.ENTER}]; 0 < node.length;) {
|
||||
var frame = node.pop();
|
||||
if (frame.phase === walkDOM.ENTER) {
|
||||
context = callbacks.enter(frame.node, frame.context);
|
||||
if (context === walkDOM.STOP) {
|
||||
return walkDOM.STOP;
|
||||
}
|
||||
node.push({node:frame.node, context, phase:walkDOM.EXIT});
|
||||
if (null !== context && void 0 !== context) {
|
||||
for (frame = frame.node.lastChild; frame;) {
|
||||
node.push({node:frame, context, phase:walkDOM.ENTER}), frame = frame.previousSibling;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
callbacks.exit && callbacks.exit(frame.node, frame.context);
|
||||
}
|
||||
}
|
||||
}
|
||||
function Document() {
|
||||
this.ownerDocument = this;
|
||||
}
|
||||
function _onUpdateChild(doc, el, newChild) {
|
||||
if (doc && doc._inc) {
|
||||
if (doc._inc++, doc = el.childNodes, newChild) {
|
||||
doc[doc.length++] = newChild;
|
||||
} else {
|
||||
el = el.firstChild;
|
||||
for (newChild = 0; el;) {
|
||||
doc[newChild++] = el, el = el.nextSibling;
|
||||
}
|
||||
doc.length = newChild;
|
||||
delete doc[doc.length];
|
||||
}
|
||||
}
|
||||
}
|
||||
function _removeChild(parentNode, child) {
|
||||
var previous = child.previousSibling, next = child.nextSibling;
|
||||
previous ? previous.nextSibling = next : parentNode.firstChild = next;
|
||||
next ? next.previousSibling = previous : parentNode.lastChild = previous;
|
||||
child.parentNode = null;
|
||||
child.previousSibling = null;
|
||||
child.nextSibling = null;
|
||||
_onUpdateChild(parentNode.ownerDocument, parentNode);
|
||||
return child;
|
||||
}
|
||||
function isDocTypeNode(node) {
|
||||
return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
|
||||
}
|
||||
function isElementNode(node) {
|
||||
return node && node.nodeType === Node.ELEMENT_NODE;
|
||||
}
|
||||
function isTextNode(node) {
|
||||
return node && node.nodeType === Node.TEXT_NODE;
|
||||
}
|
||||
function isElementInsertionPossible(doc, child) {
|
||||
doc = doc.childNodes || [];
|
||||
if (find(doc, isElementNode) || isDocTypeNode(child)) {
|
||||
return !1;
|
||||
}
|
||||
var docTypeNode = find(doc, isDocTypeNode);
|
||||
return !(child && docTypeNode && doc.indexOf(docTypeNode) > doc.indexOf(child));
|
||||
}
|
||||
function isElementReplacementPossible(doc, child) {
|
||||
doc = doc.childNodes || [];
|
||||
if (find(doc, function(node) {
|
||||
return isElementNode(node) && node !== child;
|
||||
})) {
|
||||
return !1;
|
||||
}
|
||||
var docTypeNode = find(doc, isDocTypeNode);
|
||||
return !(child && docTypeNode && doc.indexOf(docTypeNode) > doc.indexOf(child));
|
||||
}
|
||||
function assertPreInsertionValidityInDocument(parent, node, child) {
|
||||
var parentChildNodes = parent.childNodes || [], nodeChildNodes = node.childNodes || [];
|
||||
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
||||
var nodeChildElements = nodeChildNodes.filter(isElementNode);
|
||||
if (1 < nodeChildElements.length || find(nodeChildNodes, isTextNode)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
|
||||
}
|
||||
if (1 === nodeChildElements.length && !isElementInsertionPossible(parent, child)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
|
||||
}
|
||||
}
|
||||
if (isElementNode(node) && !isElementInsertionPossible(parent, child)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
|
||||
}
|
||||
if (isDocTypeNode(node)) {
|
||||
if (find(parentChildNodes, isDocTypeNode)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
|
||||
}
|
||||
parent = find(parentChildNodes, isElementNode);
|
||||
if (child && parentChildNodes.indexOf(parent) < parentChildNodes.indexOf(child)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
|
||||
}
|
||||
if (!child && parent) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
|
||||
}
|
||||
}
|
||||
}
|
||||
function assertPreReplacementValidityInDocument(parent, node, child) {
|
||||
var parentChildNodes = parent.childNodes || [], nodeChildNodes = node.childNodes || [];
|
||||
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
||||
var nodeChildElements = nodeChildNodes.filter(isElementNode);
|
||||
if (1 < nodeChildElements.length || find(nodeChildNodes, isTextNode)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
|
||||
}
|
||||
if (1 === nodeChildElements.length && !isElementReplacementPossible(parent, child)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
|
||||
}
|
||||
}
|
||||
if (isElementNode(node) && !isElementReplacementPossible(parent, child)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
|
||||
}
|
||||
if (isDocTypeNode(node)) {
|
||||
if (find(parentChildNodes, function(node) {
|
||||
return isDocTypeNode(node) && node !== child;
|
||||
})) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
|
||||
}
|
||||
parent = find(parentChildNodes, isElementNode);
|
||||
if (child && parentChildNodes.indexOf(parent) < parentChildNodes.indexOf(child)) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
|
||||
}
|
||||
}
|
||||
}
|
||||
function _insertBefore(parent, node, child, _inDocumentAssertion) {
|
||||
if (!parent || parent.nodeType !== Node.DOCUMENT_NODE && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE && parent.nodeType !== Node.ELEMENT_NODE) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
|
||||
}
|
||||
if (child && child.parentNode !== parent) {
|
||||
throw new DOMException(NOT_FOUND_ERR, "child not in parent");
|
||||
}
|
||||
if (!node || !(isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) {
|
||||
throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType);
|
||||
}
|
||||
parent.nodeType === Node.DOCUMENT_NODE && (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
|
||||
(_inDocumentAssertion = node.parentNode) && _inDocumentAssertion.removeChild(node);
|
||||
if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
||||
_inDocumentAssertion = node.firstChild;
|
||||
if (null == _inDocumentAssertion) {
|
||||
return node;
|
||||
}
|
||||
var newLast = node.lastChild;
|
||||
} else {
|
||||
_inDocumentAssertion = newLast = node;
|
||||
}
|
||||
var pre = child ? child.previousSibling : parent.lastChild;
|
||||
_inDocumentAssertion.previousSibling = pre;
|
||||
newLast.nextSibling = child;
|
||||
pre ? pre.nextSibling = _inDocumentAssertion : parent.firstChild = _inDocumentAssertion;
|
||||
null == child ? parent.lastChild = newLast : child.previousSibling = newLast;
|
||||
do {
|
||||
_inDocumentAssertion.parentNode = parent, _updateOwnerDocument(_inDocumentAssertion, parent.ownerDocument || parent);
|
||||
} while (_inDocumentAssertion !== newLast && (_inDocumentAssertion = _inDocumentAssertion.nextSibling));
|
||||
_onUpdateChild(parent.ownerDocument || parent, parent);
|
||||
node.nodeType == DOCUMENT_FRAGMENT_NODE && (node.firstChild = node.lastChild = null);
|
||||
return node;
|
||||
}
|
||||
function _updateOwnerDocument(node, newOwnerDocument) {
|
||||
if (node.ownerDocument !== newOwnerDocument) {
|
||||
node.ownerDocument = newOwnerDocument;
|
||||
if (node.nodeType === ELEMENT_NODE && node.attributes) {
|
||||
for (var i = 0; i < node.attributes.length; i++) {
|
||||
var attr = node.attributes.item(i);
|
||||
attr && (attr.ownerDocument = newOwnerDocument);
|
||||
}
|
||||
}
|
||||
for (node = node.firstChild; node;) {
|
||||
_updateOwnerDocument(node, newOwnerDocument), node = node.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
function Element() {
|
||||
this._nsMap = {};
|
||||
}
|
||||
function Attr() {
|
||||
}
|
||||
function CharacterData() {
|
||||
}
|
||||
function Text() {
|
||||
}
|
||||
function Comment() {
|
||||
}
|
||||
function CDATASection() {
|
||||
}
|
||||
function DocumentType() {
|
||||
}
|
||||
function Notation() {
|
||||
}
|
||||
function Entity() {
|
||||
}
|
||||
function EntityReference() {
|
||||
}
|
||||
function DocumentFragment() {
|
||||
}
|
||||
function ProcessingInstruction() {
|
||||
}
|
||||
function XMLSerializer() {
|
||||
}
|
||||
function nodeSerializeToString(isHtml, nodeFilter, options) {
|
||||
options = !!options && !!options.requireWellFormed;
|
||||
var buf = [], refNode = 9 == this.nodeType && this.documentElement || this, prefix = refNode.prefix, uri = refNode.namespaceURI;
|
||||
if (uri && null == prefix && (prefix = refNode.lookupPrefix(uri), null == prefix)) {
|
||||
var visibleNamespaces = [{namespace:uri, prefix:null}];
|
||||
}
|
||||
serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces, options);
|
||||
return buf.join("");
|
||||
}
|
||||
function needNamespaceDefine(node, isHTML, visibleNamespaces) {
|
||||
isHTML = node.prefix || "";
|
||||
node = node.namespaceURI;
|
||||
if (!node || "xml" === isHTML && node === NAMESPACE.XML || node === NAMESPACE.XMLNS) {
|
||||
return !1;
|
||||
}
|
||||
for (var i = visibleNamespaces.length; i--;) {
|
||||
var ns = visibleNamespaces[i];
|
||||
if (ns.prefix === isHTML) {
|
||||
return ns.namespace !== node;
|
||||
}
|
||||
}
|
||||
return !0;
|
||||
}
|
||||
function addSerializedAttribute(buf, qualifiedName, value) {
|
||||
buf.push(" ", qualifiedName, '\x3d"', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
|
||||
}
|
||||
function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
|
||||
visibleNamespaces || (visibleNamespaces = []);
|
||||
walkDOM(node, {ns:visibleNamespaces, isHTML}, {enter:function(n, ctx) {
|
||||
var ns = ctx.ns;
|
||||
ctx = ctx.isHTML;
|
||||
if (nodeFilter) {
|
||||
if (n = nodeFilter(n)) {
|
||||
if ("string" == typeof n) {
|
||||
return buf.push(n), null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
switch(n.nodeType) {
|
||||
case ELEMENT_NODE:
|
||||
var attrs = n.attributes, len = attrs.length, nodeName = n.tagName;
|
||||
ctx = NAMESPACE.isHTML(n.namespaceURI) || ctx;
|
||||
var prefixedNodeName = nodeName;
|
||||
if (!ctx && !n.prefix && n.namespaceURI) {
|
||||
for (var defaultNS, ai = 0; ai < attrs.length; ai++) {
|
||||
if ("xmlns" === attrs.item(ai).name) {
|
||||
defaultNS = attrs.item(ai).value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!defaultNS) {
|
||||
for (ai = ns.length - 1; 0 <= ai; ai--) {
|
||||
var nsEntry = ns[ai];
|
||||
if ("" === nsEntry.prefix && nsEntry.namespace === n.namespaceURI) {
|
||||
defaultNS = nsEntry.namespace;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defaultNS !== n.namespaceURI) {
|
||||
for (ai = ns.length - 1; 0 <= ai; ai--) {
|
||||
if (nsEntry = ns[ai], nsEntry.namespace === n.namespaceURI) {
|
||||
nsEntry.prefix && (prefixedNodeName = nsEntry.prefix + ":" + nodeName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.push("\x3c", prefixedNodeName);
|
||||
ns = ns.slice();
|
||||
for (defaultNS = 0; defaultNS < len; defaultNS++) {
|
||||
nsEntry = attrs.item(defaultNS), "xmlns" == nsEntry.prefix ? ns.push({prefix:nsEntry.localName, namespace:nsEntry.value}) : "xmlns" == nsEntry.nodeName && ns.push({prefix:"", namespace:nsEntry.value});
|
||||
}
|
||||
for (defaultNS = 0; defaultNS < len; defaultNS++) {
|
||||
nsEntry = attrs.item(defaultNS);
|
||||
if (needNamespaceDefine(nsEntry, ctx, ns)) {
|
||||
var attrPrefix = nsEntry.prefix || "";
|
||||
ai = nsEntry.namespaceURI;
|
||||
addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", ai);
|
||||
ns.push({prefix:attrPrefix, namespace:ai});
|
||||
}
|
||||
(ai = nodeFilter ? nodeFilter(nsEntry) : nsEntry) && ("string" === typeof ai ? buf.push(ai) : addSerializedAttribute(buf, ai.name, ai.value));
|
||||
}
|
||||
nodeName === prefixedNodeName && needNamespaceDefine(n, ctx, ns) && (attrs = n.prefix || "", ai = n.namespaceURI, addSerializedAttribute(buf, attrs ? "xmlns:" + attrs : "xmlns", ai), ns.push({prefix:attrs, namespace:ai}));
|
||||
if ((n = n.firstChild) || ctx && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
|
||||
buf.push("\x3e");
|
||||
if (ctx && /^script$/i.test(nodeName)) {
|
||||
for (; n;) {
|
||||
n.data ? buf.push(n.data) : serializeToString(n, buf, ctx, nodeFilter, ns.slice(), requireWellFormed), n = n.nextSibling;
|
||||
}
|
||||
buf.push("\x3c/", nodeName, "\x3e");
|
||||
return null;
|
||||
}
|
||||
return {ns, isHTML:ctx, tag:prefixedNodeName};
|
||||
}
|
||||
buf.push("/\x3e");
|
||||
return null;
|
||||
case DOCUMENT_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
return {ns:ns.slice(), isHTML:ctx, tag:null};
|
||||
case ATTRIBUTE_NODE:
|
||||
return addSerializedAttribute(buf, n.name, n.value), null;
|
||||
case TEXT_NODE:
|
||||
return buf.push(n.data.replace(/[<&>]/g, _xmlEncoder)), null;
|
||||
case CDATA_SECTION_NODE:
|
||||
if (requireWellFormed && -1 !== n.data.indexOf("]]\x3e")) {
|
||||
throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]\x3e"');
|
||||
}
|
||||
buf.push("\x3c![CDATA[", n.data.replace(/]]\x3e/g, "]]]]\x3e\x3c![CDATA[\x3e"), "]]\x3e");
|
||||
return null;
|
||||
case COMMENT_NODE:
|
||||
if (requireWellFormed && -1 !== n.data.indexOf("--\x3e")) {
|
||||
throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "--\x3e"');
|
||||
}
|
||||
buf.push("\x3c!--", n.data, "--\x3e");
|
||||
return null;
|
||||
case DOCUMENT_TYPE_NODE:
|
||||
if (requireWellFormed) {
|
||||
if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
|
||||
throw new DOMException(INVALID_STATE_ERR, "DocumentType publicId is not a valid PubidLiteral");
|
||||
}
|
||||
if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
|
||||
throw new DOMException(INVALID_STATE_ERR, "DocumentType systemId is not a valid SystemLiteral");
|
||||
}
|
||||
if (n.internalSubset && -1 !== n.internalSubset.indexOf("]\x3e")) {
|
||||
throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]\x3e"');
|
||||
}
|
||||
}
|
||||
ctx = n.publicId;
|
||||
nodeName = n.systemId;
|
||||
buf.push("\x3c!DOCTYPE ", n.name);
|
||||
ctx ? (buf.push(" PUBLIC ", ctx), nodeName && "." != nodeName && buf.push(" ", nodeName), buf.push("\x3e")) : nodeName && "." != nodeName ? buf.push(" SYSTEM ", nodeName, "\x3e") : ((n = n.internalSubset) && buf.push(" [", n, "]"), buf.push("\x3e"));
|
||||
return null;
|
||||
case PROCESSING_INSTRUCTION_NODE:
|
||||
if (requireWellFormed && -1 !== n.data.indexOf("?\x3e")) {
|
||||
throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?\x3e"');
|
||||
}
|
||||
buf.push("\x3c?", n.target, " ", n.data, "?\x3e");
|
||||
return null;
|
||||
case ENTITY_REFERENCE_NODE:
|
||||
return buf.push("\x26", n.nodeName, ";"), null;
|
||||
default:
|
||||
return buf.push("??", n.nodeName), null;
|
||||
}
|
||||
}, exit:function(n, childCtx) {
|
||||
childCtx && childCtx.tag && buf.push("\x3c/", childCtx.tag, "\x3e");
|
||||
}});
|
||||
}
|
||||
function importNode(doc, node, deep) {
|
||||
var destRoot;
|
||||
walkDOM(node, null, {enter:function(srcNode, destParent) {
|
||||
var destNode = srcNode.cloneNode(!1);
|
||||
destNode.ownerDocument = doc;
|
||||
destNode.parentNode = null;
|
||||
null === destParent ? destRoot = destNode : destParent.appendChild(destNode);
|
||||
return srcNode.nodeType === ATTRIBUTE_NODE || deep ? destNode : null;
|
||||
}});
|
||||
return destRoot;
|
||||
}
|
||||
function cloneNode(doc, node, deep) {
|
||||
var destRoot;
|
||||
walkDOM(node, null, {enter:function(srcNode, destParent) {
|
||||
var destNode = new srcNode.constructor();
|
||||
for (n in srcNode) {
|
||||
if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
|
||||
var v = srcNode[n];
|
||||
"object" != typeof v && v != destNode[n] && (destNode[n] = v);
|
||||
}
|
||||
}
|
||||
srcNode.childNodes && (destNode.childNodes = new NodeList());
|
||||
destNode.ownerDocument = doc;
|
||||
var n = deep;
|
||||
switch(destNode.nodeType) {
|
||||
case ELEMENT_NODE:
|
||||
srcNode = srcNode.attributes;
|
||||
var attrs2 = destNode.attributes = new NamedNodeMap();
|
||||
v = srcNode.length;
|
||||
attrs2._ownerElement = destNode;
|
||||
for (attrs2 = 0; attrs2 < v; attrs2++) {
|
||||
destNode.setAttributeNode(cloneNode(doc, srcNode.item(attrs2), !0));
|
||||
}
|
||||
break;
|
||||
case ATTRIBUTE_NODE:
|
||||
n = !0;
|
||||
}
|
||||
null !== destParent ? destParent.appendChild(destNode) : destRoot = destNode;
|
||||
return n ? destNode : null;
|
||||
}});
|
||||
return destRoot;
|
||||
}
|
||||
function __set__(object, key, value) {
|
||||
object[key] = value;
|
||||
}
|
||||
global = require("module$node_modules$$xmldom$xmldom$lib$conventions");
|
||||
var find = global.find, NAMESPACE = global.NAMESPACE;
|
||||
global = {};
|
||||
var ELEMENT_NODE = global.ELEMENT_NODE = 1, ATTRIBUTE_NODE = global.ATTRIBUTE_NODE = 2, TEXT_NODE = global.TEXT_NODE = 3, CDATA_SECTION_NODE = global.CDATA_SECTION_NODE = 4, ENTITY_REFERENCE_NODE = global.ENTITY_REFERENCE_NODE = 5;
|
||||
require = global.ENTITY_NODE = 6;
|
||||
var PROCESSING_INSTRUCTION_NODE = global.PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = global.COMMENT_NODE = 8, DOCUMENT_NODE = global.DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = global.DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = global.DOCUMENT_FRAGMENT_NODE = 11;
|
||||
module = global.NOTATION_NODE = 12;
|
||||
var ExceptionCode = {}, ExceptionMessage = {};
|
||||
ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
|
||||
ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
|
||||
var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
|
||||
ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
|
||||
var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
|
||||
ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
|
||||
ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
|
||||
var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
|
||||
ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
|
||||
var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10), INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
|
||||
ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
|
||||
ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
|
||||
ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
|
||||
ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
|
||||
DOMException.prototype = Error.prototype;
|
||||
copy(ExceptionCode, DOMException);
|
||||
NodeList.prototype = {length:0, item:function(index) {
|
||||
return 0 <= index && index < this.length ? this[index] : null;
|
||||
}, toString:function(isHTML, nodeFilter, options) {
|
||||
options = !!options && !!options.requireWellFormed;
|
||||
for (var buf = [], i = 0; i < this.length; i++) {
|
||||
serializeToString(this[i], buf, isHTML, nodeFilter, null, options);
|
||||
}
|
||||
return buf.join("");
|
||||
}, filter:function(predicate) {
|
||||
return Array.prototype.filter.call(this, predicate);
|
||||
}, indexOf:function(item) {
|
||||
return Array.prototype.indexOf.call(this, item);
|
||||
}};
|
||||
LiveNodeList.prototype.item = function(i) {
|
||||
_updateLiveList(this);
|
||||
return this[i] || null;
|
||||
};
|
||||
_extends(LiveNodeList, NodeList);
|
||||
NamedNodeMap.prototype = {length:0, item:NodeList.prototype.item, getNamedItem:function(key) {
|
||||
for (var i = this.length; i--;) {
|
||||
var attr = this[i];
|
||||
if (attr.nodeName == key) {
|
||||
return attr;
|
||||
}
|
||||
}
|
||||
}, setNamedItem:function(attr) {
|
||||
var el = attr.ownerElement;
|
||||
if (el && el != this._ownerElement) {
|
||||
throw new DOMException(INUSE_ATTRIBUTE_ERR);
|
||||
}
|
||||
el = this.getNamedItem(attr.nodeName);
|
||||
_addNamedNode(this._ownerElement, this, attr, el);
|
||||
return el;
|
||||
}, setNamedItemNS:function(attr) {
|
||||
var el = attr.ownerElement;
|
||||
if (el && el != this._ownerElement) {
|
||||
throw new DOMException(INUSE_ATTRIBUTE_ERR);
|
||||
}
|
||||
el = this.getNamedItemNS(attr.namespaceURI, attr.localName);
|
||||
_addNamedNode(this._ownerElement, this, attr, el);
|
||||
return el;
|
||||
}, removeNamedItem:function(key) {
|
||||
key = this.getNamedItem(key);
|
||||
_removeNamedNode(this._ownerElement, this, key);
|
||||
return key;
|
||||
}, removeNamedItemNS:function(namespaceURI, localName) {
|
||||
namespaceURI = this.getNamedItemNS(namespaceURI, localName);
|
||||
_removeNamedNode(this._ownerElement, this, namespaceURI);
|
||||
return namespaceURI;
|
||||
}, getNamedItemNS:function(namespaceURI, localName) {
|
||||
for (var i = this.length; i--;) {
|
||||
var node = this[i];
|
||||
if (node.localName == localName && node.namespaceURI == namespaceURI) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}};
|
||||
DOMImplementation.prototype = {hasFeature:function(feature, version) {
|
||||
return !0;
|
||||
}, createDocument:function(namespaceURI, qualifiedName, doctype) {
|
||||
var doc = new Document();
|
||||
doc.implementation = this;
|
||||
doc.childNodes = new NodeList();
|
||||
doc.doctype = doctype || null;
|
||||
doctype && doc.appendChild(doctype);
|
||||
qualifiedName && (namespaceURI = doc.createElementNS(namespaceURI, qualifiedName), doc.appendChild(namespaceURI));
|
||||
return doc;
|
||||
}, createDocumentType:function(qualifiedName, publicId, systemId) {
|
||||
var node = new DocumentType();
|
||||
node.name = qualifiedName;
|
||||
node.nodeName = qualifiedName;
|
||||
node.publicId = publicId || "";
|
||||
node.systemId = systemId || "";
|
||||
return node;
|
||||
}};
|
||||
Node.prototype = {firstChild:null, lastChild:null, previousSibling:null, nextSibling:null, attributes:null, parentNode:null, childNodes:null, ownerDocument:null, nodeValue:null, namespaceURI:null, prefix:null, localName:null, insertBefore:function(newChild, refChild) {
|
||||
return _insertBefore(this, newChild, refChild);
|
||||
}, replaceChild:function(newChild, oldChild) {
|
||||
_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
|
||||
oldChild && this.removeChild(oldChild);
|
||||
}, removeChild:function(oldChild) {
|
||||
return _removeChild(this, oldChild);
|
||||
}, appendChild:function(newChild) {
|
||||
return this.insertBefore(newChild, null);
|
||||
}, hasChildNodes:function() {
|
||||
return null != this.firstChild;
|
||||
}, cloneNode:function(deep) {
|
||||
return cloneNode(this.ownerDocument || this, this, deep);
|
||||
}, normalize:function() {
|
||||
walkDOM(this, null, {enter:function(node) {
|
||||
for (var child = node.firstChild; child;) {
|
||||
var next = child.nextSibling;
|
||||
null !== next && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE ? (node.removeChild(next), child.appendData(next.data)) : child = next;
|
||||
}
|
||||
return !0;
|
||||
}});
|
||||
}, isSupported:function(feature, version) {
|
||||
return this.ownerDocument.implementation.hasFeature(feature, version);
|
||||
}, hasAttributes:function() {
|
||||
return 0 < this.attributes.length;
|
||||
}, lookupPrefix:function(namespaceURI) {
|
||||
for (var el = this; el;) {
|
||||
var map = el._nsMap;
|
||||
if (map) {
|
||||
for (var n in map) {
|
||||
if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
}
|
||||
el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
|
||||
}
|
||||
return null;
|
||||
}, lookupNamespaceURI:function(prefix) {
|
||||
for (var el = this; el;) {
|
||||
var map = el._nsMap;
|
||||
if (map && Object.prototype.hasOwnProperty.call(map, prefix)) {
|
||||
return map[prefix];
|
||||
}
|
||||
el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
|
||||
}
|
||||
return null;
|
||||
}, isDefaultNamespace:function(namespaceURI) {
|
||||
return null == this.lookupPrefix(namespaceURI);
|
||||
}};
|
||||
copy(global, Node);
|
||||
copy(global, Node.prototype);
|
||||
walkDOM.STOP = Symbol("walkDOM.STOP");
|
||||
walkDOM.ENTER = 0;
|
||||
walkDOM.EXIT = 1;
|
||||
Document.prototype = {nodeName:"#document", nodeType:DOCUMENT_NODE, doctype:null, documentElement:null, _inc:1, insertBefore:function(newChild, refChild) {
|
||||
if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
|
||||
for (var child = newChild.firstChild; child;) {
|
||||
var next = child.nextSibling;
|
||||
this.insertBefore(child, refChild);
|
||||
child = next;
|
||||
}
|
||||
return newChild;
|
||||
}
|
||||
_insertBefore(this, newChild, refChild);
|
||||
_updateOwnerDocument(newChild, this);
|
||||
null === this.documentElement && newChild.nodeType === ELEMENT_NODE && (this.documentElement = newChild);
|
||||
return newChild;
|
||||
}, removeChild:function(oldChild) {
|
||||
this.documentElement == oldChild && (this.documentElement = null);
|
||||
return _removeChild(this, oldChild);
|
||||
}, replaceChild:function(newChild, oldChild) {
|
||||
_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
|
||||
_updateOwnerDocument(newChild, this);
|
||||
oldChild && this.removeChild(oldChild);
|
||||
isElementNode(newChild) && (this.documentElement = newChild);
|
||||
}, importNode:function(importedNode, deep) {
|
||||
return importNode(this, importedNode, deep);
|
||||
}, getElementById:function(id) {
|
||||
var rtv = null;
|
||||
_visitNode(this.documentElement, function(node) {
|
||||
if (node.nodeType == ELEMENT_NODE && node.getAttribute("id") == id) {
|
||||
return rtv = node, !0;
|
||||
}
|
||||
});
|
||||
return rtv;
|
||||
}, getElementsByClassName:function(classNames) {
|
||||
var classNamesSet = toOrderedSet(classNames);
|
||||
return new LiveNodeList(this, function(base) {
|
||||
var ls = [];
|
||||
0 < classNamesSet.length && _visitNode(base.documentElement, function(node) {
|
||||
if (node !== base && node.nodeType === ELEMENT_NODE) {
|
||||
var nodeClassNames = node.getAttribute("class");
|
||||
if (nodeClassNames) {
|
||||
var matches = classNames === nodeClassNames;
|
||||
matches || (nodeClassNames = toOrderedSet(nodeClassNames), matches = classNamesSet.every(arrayIncludes(nodeClassNames)));
|
||||
matches && ls.push(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
return ls;
|
||||
});
|
||||
}, createElement:function(tagName) {
|
||||
var node = new Element();
|
||||
node.ownerDocument = this;
|
||||
node.nodeName = tagName;
|
||||
node.tagName = tagName;
|
||||
node.localName = tagName;
|
||||
node.childNodes = new NodeList();
|
||||
return (node.attributes = new NamedNodeMap())._ownerElement = node;
|
||||
}, createDocumentFragment:function() {
|
||||
var node = new DocumentFragment();
|
||||
node.ownerDocument = this;
|
||||
node.childNodes = new NodeList();
|
||||
return node;
|
||||
}, createTextNode:function(data) {
|
||||
var node = new Text();
|
||||
node.ownerDocument = this;
|
||||
node.appendData(data);
|
||||
return node;
|
||||
}, createComment:function(data) {
|
||||
var node = new Comment();
|
||||
node.ownerDocument = this;
|
||||
node.appendData(data);
|
||||
return node;
|
||||
}, createCDATASection:function(data) {
|
||||
if (-1 !== data.indexOf("]]\x3e")) {
|
||||
throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]\x3e"');
|
||||
}
|
||||
var node = new CDATASection();
|
||||
node.ownerDocument = this;
|
||||
node.appendData(data);
|
||||
return node;
|
||||
}, createProcessingInstruction:function(target, data) {
|
||||
var node = new ProcessingInstruction();
|
||||
node.ownerDocument = this;
|
||||
node.tagName = node.nodeName = node.target = target;
|
||||
node.nodeValue = node.data = data;
|
||||
return node;
|
||||
}, createAttribute:function(name) {
|
||||
var node = new Attr();
|
||||
node.ownerDocument = this;
|
||||
node.name = name;
|
||||
node.nodeName = name;
|
||||
node.localName = name;
|
||||
node.specified = !0;
|
||||
return node;
|
||||
}, createEntityReference:function(name) {
|
||||
var node = new EntityReference();
|
||||
node.ownerDocument = this;
|
||||
node.nodeName = name;
|
||||
return node;
|
||||
}, createElementNS:function(namespaceURI, qualifiedName) {
|
||||
var node = new Element(), pl = qualifiedName.split(":"), attrs = node.attributes = new NamedNodeMap();
|
||||
node.childNodes = new NodeList();
|
||||
node.ownerDocument = this;
|
||||
node.nodeName = qualifiedName;
|
||||
node.tagName = qualifiedName;
|
||||
node.namespaceURI = namespaceURI;
|
||||
2 == pl.length ? (node.prefix = pl[0], node.localName = pl[1]) : node.localName = qualifiedName;
|
||||
return attrs._ownerElement = node;
|
||||
}, createAttributeNS:function(namespaceURI, qualifiedName) {
|
||||
var node = new Attr(), pl = qualifiedName.split(":");
|
||||
node.ownerDocument = this;
|
||||
node.nodeName = qualifiedName;
|
||||
node.name = qualifiedName;
|
||||
node.namespaceURI = namespaceURI;
|
||||
node.specified = !0;
|
||||
2 == pl.length ? (node.prefix = pl[0], node.localName = pl[1]) : node.localName = qualifiedName;
|
||||
return node;
|
||||
}};
|
||||
_extends(Document, Node);
|
||||
Element.prototype = {nodeType:ELEMENT_NODE, hasAttribute:function(name) {
|
||||
return null != this.getAttributeNode(name);
|
||||
}, getAttribute:function(name) {
|
||||
return (name = this.getAttributeNode(name)) && name.value || "";
|
||||
}, getAttributeNode:function(name) {
|
||||
return this.attributes.getNamedItem(name);
|
||||
}, setAttribute:function(name, value) {
|
||||
name = this.ownerDocument.createAttribute(name);
|
||||
name.value = name.nodeValue = "" + value;
|
||||
this.setAttributeNode(name);
|
||||
}, removeAttribute:function(name) {
|
||||
(name = this.getAttributeNode(name)) && this.removeAttributeNode(name);
|
||||
}, appendChild:function(newChild) {
|
||||
if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
||||
return this.insertBefore(newChild, null);
|
||||
}
|
||||
newChild.parentNode && newChild.parentNode.removeChild(newChild);
|
||||
newChild.parentNode = this;
|
||||
newChild.previousSibling = this.lastChild;
|
||||
newChild.nextSibling = null;
|
||||
newChild.previousSibling ? newChild.previousSibling.nextSibling = newChild : this.firstChild = newChild;
|
||||
this.lastChild = newChild;
|
||||
_onUpdateChild(this.ownerDocument, this, newChild);
|
||||
_updateOwnerDocument(newChild, this.ownerDocument || this);
|
||||
return newChild;
|
||||
}, setAttributeNode:function(newAttr) {
|
||||
return this.attributes.setNamedItem(newAttr);
|
||||
}, setAttributeNodeNS:function(newAttr) {
|
||||
return this.attributes.setNamedItemNS(newAttr);
|
||||
}, removeAttributeNode:function(oldAttr) {
|
||||
return this.attributes.removeNamedItem(oldAttr.nodeName);
|
||||
}, removeAttributeNS:function(namespaceURI, localName) {
|
||||
(namespaceURI = this.getAttributeNodeNS(namespaceURI, localName)) && this.removeAttributeNode(namespaceURI);
|
||||
}, hasAttributeNS:function(namespaceURI, localName) {
|
||||
return null != this.getAttributeNodeNS(namespaceURI, localName);
|
||||
}, getAttributeNS:function(namespaceURI, localName) {
|
||||
return (namespaceURI = this.getAttributeNodeNS(namespaceURI, localName)) && namespaceURI.value || "";
|
||||
}, setAttributeNS:function(namespaceURI, qualifiedName, value) {
|
||||
namespaceURI = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
|
||||
namespaceURI.value = namespaceURI.nodeValue = "" + value;
|
||||
this.setAttributeNode(namespaceURI);
|
||||
}, getAttributeNodeNS:function(namespaceURI, localName) {
|
||||
return this.attributes.getNamedItemNS(namespaceURI, localName);
|
||||
}, getElementsByTagName:function(tagName) {
|
||||
return new LiveNodeList(this, function(base) {
|
||||
var ls = [];
|
||||
_visitNode(base, function(node) {
|
||||
node === base || node.nodeType != ELEMENT_NODE || "*" !== tagName && node.tagName != tagName || ls.push(node);
|
||||
});
|
||||
return ls;
|
||||
});
|
||||
}, getElementsByTagNameNS:function(namespaceURI, localName) {
|
||||
return new LiveNodeList(this, function(base) {
|
||||
var ls = [];
|
||||
_visitNode(base, function(node) {
|
||||
node === base || node.nodeType !== ELEMENT_NODE || "*" !== namespaceURI && node.namespaceURI !== namespaceURI || "*" !== localName && node.localName != localName || ls.push(node);
|
||||
});
|
||||
return ls;
|
||||
});
|
||||
}};
|
||||
Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
|
||||
Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
|
||||
_extends(Element, Node);
|
||||
Attr.prototype.nodeType = ATTRIBUTE_NODE;
|
||||
_extends(Attr, Node);
|
||||
CharacterData.prototype = {data:"", substringData:function(offset, count) {
|
||||
return this.data.substring(offset, offset + count);
|
||||
}, appendData:function(text) {
|
||||
this.nodeValue = this.data = text = this.data + text;
|
||||
this.length = text.length;
|
||||
}, insertData:function(offset, text) {
|
||||
this.replaceData(offset, 0, text);
|
||||
}, appendChild:function(newChild) {
|
||||
throw Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
|
||||
}, deleteData:function(offset, count) {
|
||||
this.replaceData(offset, count, "");
|
||||
}, replaceData:function(offset, count, text) {
|
||||
var start = this.data.substring(0, offset);
|
||||
offset = this.data.substring(offset + count);
|
||||
this.nodeValue = this.data = text = start + text + offset;
|
||||
this.length = text.length;
|
||||
}};
|
||||
_extends(CharacterData, Node);
|
||||
Text.prototype = {nodeName:"#text", nodeType:TEXT_NODE, splitText:function(offset) {
|
||||
var text = this.data, newText = text.substring(offset);
|
||||
this.data = this.nodeValue = text = text.substring(0, offset);
|
||||
this.length = text.length;
|
||||
offset = this.ownerDocument.createTextNode(newText);
|
||||
this.parentNode && this.parentNode.insertBefore(offset, this.nextSibling);
|
||||
return offset;
|
||||
}};
|
||||
_extends(Text, CharacterData);
|
||||
Comment.prototype = {nodeName:"#comment", nodeType:COMMENT_NODE};
|
||||
_extends(Comment, CharacterData);
|
||||
CDATASection.prototype = {nodeName:"#cdata-section", nodeType:CDATA_SECTION_NODE};
|
||||
_extends(CDATASection, CharacterData);
|
||||
DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
|
||||
_extends(DocumentType, Node);
|
||||
Notation.prototype.nodeType = module;
|
||||
_extends(Notation, Node);
|
||||
Entity.prototype.nodeType = require;
|
||||
_extends(Entity, Node);
|
||||
EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
|
||||
_extends(EntityReference, Node);
|
||||
DocumentFragment.prototype.nodeName = "#document-fragment";
|
||||
DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
|
||||
_extends(DocumentFragment, Node);
|
||||
ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
|
||||
_extends(ProcessingInstruction, Node);
|
||||
XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter, options) {
|
||||
return nodeSerializeToString.call(node, isHtml, nodeFilter, options);
|
||||
};
|
||||
Node.prototype.toString = nodeSerializeToString;
|
||||
try {
|
||||
Object.defineProperty && (Object.defineProperty(LiveNodeList.prototype, "length", {get:function() {
|
||||
_updateLiveList(this);
|
||||
return this.$$length;
|
||||
}}), Object.defineProperty(Node.prototype, "textContent", {get:function() {
|
||||
if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
||||
var buf = [];
|
||||
walkDOM(this, null, {enter:function(n) {
|
||||
if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
||||
return !0;
|
||||
}
|
||||
if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
|
||||
return null;
|
||||
}
|
||||
buf.push(n.nodeValue);
|
||||
}});
|
||||
return buf.join("");
|
||||
}
|
||||
return this.nodeValue;
|
||||
}, set:function(data) {
|
||||
switch(this.nodeType) {
|
||||
case ELEMENT_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
for (; this.firstChild;) {
|
||||
this.removeChild(this.firstChild);
|
||||
}
|
||||
(data || String(data)) && this.appendChild(this.ownerDocument.createTextNode(data));
|
||||
break;
|
||||
default:
|
||||
this.nodeValue = this.value = this.data = data;
|
||||
}
|
||||
}}), __set__ = function(object, key, value) {
|
||||
object["$$" + key] = value;
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
exports.DocumentType = DocumentType;
|
||||
exports.DOMException = DOMException;
|
||||
exports.DOMImplementation = DOMImplementation;
|
||||
exports.Element = Element;
|
||||
exports.Node = Node;
|
||||
exports.NodeList = NodeList;
|
||||
exports.walkDOM = walkDOM;
|
||||
exports.XMLSerializer = XMLSerializer;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=module$node_modules$$xmldom$xmldom$lib$dom.js.map
|
||||
Reference in New Issue
Block a user