@wavemaker/angular-app 11.15.1-rc.6451 → 11.15.2-rc.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dependencies/pipe-provider.cjs.js +1154 -624
- package/dependencies/transpilation-web.cjs.js +577 -312
- package/dependency-report.html +1 -1
- package/npm-shrinkwrap.json +195 -198
- package/package-lock.json +195 -198
- package/package.json +5 -5
|
@@ -37813,14 +37813,14 @@ function requireDom () {
|
|
|
37813
37813
|
ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
|
|
37814
37814
|
var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
|
|
37815
37815
|
ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
|
|
37816
|
-
ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
|
|
37816
|
+
var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
|
|
37817
37817
|
ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
|
|
37818
37818
|
ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
|
|
37819
37819
|
var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
|
|
37820
37820
|
ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
|
|
37821
37821
|
var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
|
|
37822
37822
|
//level2
|
|
37823
|
-
ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
|
|
37823
|
+
var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
|
|
37824
37824
|
ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
|
|
37825
37825
|
ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
|
|
37826
37826
|
ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
|
|
@@ -37870,9 +37870,10 @@ function requireDom () {
|
|
|
37870
37870
|
item: function(index) {
|
|
37871
37871
|
return index >= 0 && index < this.length ? this[index] : null;
|
|
37872
37872
|
},
|
|
37873
|
-
toString:function(isHTML,nodeFilter){
|
|
37873
|
+
toString:function(isHTML,nodeFilter,options){
|
|
37874
|
+
var requireWellFormed = !!options && !!options.requireWellFormed;
|
|
37874
37875
|
for(var buf = [], i = 0;i<this.length;i++){
|
|
37875
|
-
serializeToString(this[i],buf,isHTML,nodeFilter);
|
|
37876
|
+
serializeToString(this[i],buf,isHTML,nodeFilter,null,requireWellFormed);
|
|
37876
37877
|
}
|
|
37877
37878
|
return buf.join('');
|
|
37878
37879
|
},
|
|
@@ -38117,13 +38118,28 @@ function requireDom () {
|
|
|
38117
38118
|
/**
|
|
38118
38119
|
* Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
|
|
38119
38120
|
*
|
|
38120
|
-
* __This
|
|
38121
|
+
* __This implementation differs from the specification:__
|
|
38121
38122
|
* - this implementation is not validating names or qualified names
|
|
38122
38123
|
* (when parsing XML strings, the SAX parser takes care of that)
|
|
38123
38124
|
*
|
|
38125
|
+
* Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
|
|
38126
|
+
* Creation-time validation of `publicId`, `systemId` is not enforced.
|
|
38127
|
+
* The serializer-level check covers all mutation vectors, including direct property writes.
|
|
38128
|
+
* `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
|
|
38129
|
+
* absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
|
|
38130
|
+
* silently omitted from the serialized output.
|
|
38131
|
+
*
|
|
38124
38132
|
* @param {string} qualifiedName
|
|
38125
38133
|
* @param {string} [publicId]
|
|
38134
|
+
* The external subset public identifier. Stored verbatim including surrounding quotes.
|
|
38135
|
+
* When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
|
|
38136
|
+
* throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
|
|
38137
|
+
* not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
|
|
38126
38138
|
* @param {string} [systemId]
|
|
38139
|
+
* The external subset system identifier. Stored verbatim including surrounding quotes.
|
|
38140
|
+
* When serialized with `requireWellFormed: true`, throws `DOMException` with code
|
|
38141
|
+
* `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
|
|
38142
|
+
* production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
|
|
38127
38143
|
* @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
|
|
38128
38144
|
* or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
|
|
38129
38145
|
*
|
|
@@ -38189,18 +38205,44 @@ function requireDom () {
|
|
|
38189
38205
|
return cloneNode(this.ownerDocument||this,this,deep);
|
|
38190
38206
|
},
|
|
38191
38207
|
// Modified in DOM Level 2:
|
|
38192
|
-
|
|
38193
|
-
|
|
38194
|
-
|
|
38195
|
-
|
|
38196
|
-
|
|
38197
|
-
|
|
38198
|
-
|
|
38199
|
-
|
|
38200
|
-
|
|
38201
|
-
|
|
38202
|
-
|
|
38203
|
-
|
|
38208
|
+
/**
|
|
38209
|
+
* Puts the specified node and all of its subtree into a "normalized" form. In a normalized
|
|
38210
|
+
* subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
|
|
38211
|
+
*
|
|
38212
|
+
* Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
|
|
38213
|
+
* is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
|
|
38214
|
+
* nodes.
|
|
38215
|
+
*
|
|
38216
|
+
* This method iteratively traverses all child nodes to normalize all descendant nodes within
|
|
38217
|
+
* the subtree.
|
|
38218
|
+
*
|
|
38219
|
+
* @throws {DOMException}
|
|
38220
|
+
* May throw a DOMException if operations within removeChild or appendData (which are
|
|
38221
|
+
* potentially invoked in this method) do not meet their specific constraints.
|
|
38222
|
+
* @see {@link Node.removeChild}
|
|
38223
|
+
* @see {@link CharacterData.appendData}
|
|
38224
|
+
* @see ../docs/walk-dom.md.
|
|
38225
|
+
*/
|
|
38226
|
+
normalize: function () {
|
|
38227
|
+
walkDOM(this, null, {
|
|
38228
|
+
enter: function (node) {
|
|
38229
|
+
// Merge adjacent text children of node before walkDOM schedules them.
|
|
38230
|
+
// walkDOM reads lastChild/previousSibling after enter returns, so the
|
|
38231
|
+
// surviving post-merge children are what it descends into.
|
|
38232
|
+
var child = node.firstChild;
|
|
38233
|
+
while (child) {
|
|
38234
|
+
var next = child.nextSibling;
|
|
38235
|
+
if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
|
|
38236
|
+
node.removeChild(next);
|
|
38237
|
+
child.appendData(next.data);
|
|
38238
|
+
// Do not advance child: re-check new nextSibling for another text run
|
|
38239
|
+
} else {
|
|
38240
|
+
child = next;
|
|
38241
|
+
}
|
|
38242
|
+
}
|
|
38243
|
+
return true; // descend into surviving children
|
|
38244
|
+
},
|
|
38245
|
+
});
|
|
38204
38246
|
},
|
|
38205
38247
|
// Introduced in DOM Level 2:
|
|
38206
38248
|
isSupported:function(feature, version){
|
|
@@ -38276,21 +38318,103 @@ function requireDom () {
|
|
|
38276
38318
|
copy(NodeType,Node.prototype);
|
|
38277
38319
|
|
|
38278
38320
|
/**
|
|
38279
|
-
* @param
|
|
38280
|
-
*
|
|
38321
|
+
* @param {Node} node
|
|
38322
|
+
* Root of the subtree to visit.
|
|
38323
|
+
* @param {function(Node): boolean} callback
|
|
38324
|
+
* Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
|
|
38325
|
+
* @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
|
|
38281
38326
|
*/
|
|
38282
|
-
function _visitNode(node,callback){
|
|
38283
|
-
|
|
38284
|
-
return true;
|
|
38285
|
-
}
|
|
38286
|
-
if(node = node.firstChild){
|
|
38287
|
-
do{
|
|
38288
|
-
if(_visitNode(node,callback)){return true}
|
|
38289
|
-
}while(node=node.nextSibling)
|
|
38290
|
-
}
|
|
38327
|
+
function _visitNode(node, callback) {
|
|
38328
|
+
return walkDOM(node, null, { enter: function (n) { return callback(n) ? walkDOM.STOP : true; } }) === walkDOM.STOP;
|
|
38291
38329
|
}
|
|
38292
38330
|
|
|
38331
|
+
/**
|
|
38332
|
+
* Depth-first pre/post-order DOM tree walker.
|
|
38333
|
+
*
|
|
38334
|
+
* Visits every node in the subtree rooted at `node`. For each node:
|
|
38335
|
+
*
|
|
38336
|
+
* 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
|
|
38337
|
+
* return value becomes the `context` passed to each child's `enter` call and to the matching
|
|
38338
|
+
* `exit` call.
|
|
38339
|
+
* 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
|
|
38340
|
+
* sibling traversal continues normally.
|
|
38341
|
+
* 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
|
|
38342
|
+
* further `enter` or `exit` calls are made.
|
|
38343
|
+
* 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
|
|
38344
|
+
* safely modify the node's own child list before the walker descends. Modifying siblings of
|
|
38345
|
+
* the current node or any other part of the tree produces unpredictable results: nodes already
|
|
38346
|
+
* queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
|
|
38347
|
+
* the current child list are never visited.
|
|
38348
|
+
* 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
|
|
38349
|
+
* been visited, passing the same `context` that `enter`
|
|
38350
|
+
* returned for that node.
|
|
38351
|
+
*
|
|
38352
|
+
* This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
|
|
38353
|
+
* deep trees.
|
|
38354
|
+
*
|
|
38355
|
+
* @param {Node} node
|
|
38356
|
+
* Root of the subtree to walk.
|
|
38357
|
+
* @param {*} context
|
|
38358
|
+
* Initial context value passed to the root node's `enter`.
|
|
38359
|
+
* @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
|
|
38360
|
+
* @returns {void | walkDOM.STOP}
|
|
38361
|
+
* @see ../docs/walk-dom.md.
|
|
38362
|
+
*/
|
|
38363
|
+
function walkDOM(node, context, callbacks) {
|
|
38364
|
+
// Each stack frame is {node, context, phase}:
|
|
38365
|
+
// walkDOM.ENTER — call enter, then push children
|
|
38366
|
+
// walkDOM.EXIT — call exit
|
|
38367
|
+
var stack = [{ node: node, context: context, phase: walkDOM.ENTER }];
|
|
38368
|
+
while (stack.length > 0) {
|
|
38369
|
+
var frame = stack.pop();
|
|
38370
|
+
if (frame.phase === walkDOM.ENTER) {
|
|
38371
|
+
var childContext = callbacks.enter(frame.node, frame.context);
|
|
38372
|
+
if (childContext === walkDOM.STOP) {
|
|
38373
|
+
return walkDOM.STOP;
|
|
38374
|
+
}
|
|
38375
|
+
// Push exit frame before children so it fires after all children are processed (Last In First Out)
|
|
38376
|
+
stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
|
|
38377
|
+
if (childContext === null || childContext === undefined) {
|
|
38378
|
+
continue; // skip children
|
|
38379
|
+
}
|
|
38380
|
+
// lastChild is read after enter returns, so enter may modify the child list.
|
|
38381
|
+
var child = frame.node.lastChild;
|
|
38382
|
+
// Traverse from lastChild backwards so that pushing onto the stack
|
|
38383
|
+
// naturally yields firstChild on top (processed first).
|
|
38384
|
+
while (child) {
|
|
38385
|
+
stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
|
|
38386
|
+
child = child.previousSibling;
|
|
38387
|
+
}
|
|
38388
|
+
} else {
|
|
38389
|
+
// frame.phase === walkDOM.EXIT
|
|
38390
|
+
if (callbacks.exit) {
|
|
38391
|
+
callbacks.exit(frame.node, frame.context);
|
|
38392
|
+
}
|
|
38393
|
+
}
|
|
38394
|
+
}
|
|
38395
|
+
}
|
|
38293
38396
|
|
|
38397
|
+
/**
|
|
38398
|
+
* Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
|
|
38399
|
+
* immediately.
|
|
38400
|
+
*
|
|
38401
|
+
* @type {symbol}
|
|
38402
|
+
*/
|
|
38403
|
+
walkDOM.STOP = Symbol('walkDOM.STOP');
|
|
38404
|
+
/**
|
|
38405
|
+
* Phase constant for a stack frame that has not yet been visited.
|
|
38406
|
+
* The `enter` callback is called and children are scheduled.
|
|
38407
|
+
*
|
|
38408
|
+
* @type {number}
|
|
38409
|
+
*/
|
|
38410
|
+
walkDOM.ENTER = 0;
|
|
38411
|
+
/**
|
|
38412
|
+
* Phase constant for a stack frame whose subtree has been fully visited.
|
|
38413
|
+
* The `exit` callback is called.
|
|
38414
|
+
*
|
|
38415
|
+
* @type {number}
|
|
38416
|
+
*/
|
|
38417
|
+
walkDOM.EXIT = 1;
|
|
38294
38418
|
|
|
38295
38419
|
function Document(){
|
|
38296
38420
|
this.ownerDocument = this;
|
|
@@ -38894,12 +39018,44 @@ function requireDom () {
|
|
|
38894
39018
|
node.appendData(data);
|
|
38895
39019
|
return node;
|
|
38896
39020
|
},
|
|
39021
|
+
/**
|
|
39022
|
+
* Returns a new CDATASection node whose data is `data`.
|
|
39023
|
+
*
|
|
39024
|
+
* __This implementation differs from the specification:__
|
|
39025
|
+
* - calling this method on an HTML document does not throw `NotSupportedError`.
|
|
39026
|
+
*
|
|
39027
|
+
* @param {string} data
|
|
39028
|
+
* @returns {CDATASection}
|
|
39029
|
+
* @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
|
|
39030
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
|
|
39031
|
+
* @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
|
|
39032
|
+
*/
|
|
38897
39033
|
createCDATASection : function(data){
|
|
39034
|
+
if (data.indexOf(']]>') !== -1) {
|
|
39035
|
+
throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
|
|
39036
|
+
}
|
|
38898
39037
|
var node = new CDATASection();
|
|
38899
39038
|
node.ownerDocument = this;
|
|
38900
39039
|
node.appendData(data);
|
|
38901
39040
|
return node;
|
|
38902
39041
|
},
|
|
39042
|
+
/**
|
|
39043
|
+
* Returns a ProcessingInstruction node whose target is target and data is data.
|
|
39044
|
+
*
|
|
39045
|
+
* __This implementation differs from the specification:__
|
|
39046
|
+
* - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
|
|
39047
|
+
*
|
|
39048
|
+
* Note: When the resulting document is serialized with `requireWellFormed: true`, the
|
|
39049
|
+
* serializer throws with code `INVALID_STATE_ERR` if `.data` contains `?>` (W3C DOM Parsing
|
|
39050
|
+
* §3.2.1.7). Without that option the data is emitted verbatim.
|
|
39051
|
+
*
|
|
39052
|
+
* @param {string} target
|
|
39053
|
+
* @param {string} data
|
|
39054
|
+
* @returns {ProcessingInstruction}
|
|
39055
|
+
* @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
|
|
39056
|
+
* @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
|
39057
|
+
* @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
|
|
39058
|
+
*/
|
|
38903
39059
|
createProcessingInstruction : function(target,data){
|
|
38904
39060
|
var node = new ProcessingInstruction();
|
|
38905
39061
|
node.ownerDocument = this;
|
|
@@ -39125,6 +39281,19 @@ function requireDom () {
|
|
|
39125
39281
|
_extends(CDATASection,CharacterData);
|
|
39126
39282
|
|
|
39127
39283
|
|
|
39284
|
+
/**
|
|
39285
|
+
* Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
|
|
39286
|
+
*
|
|
39287
|
+
* `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
|
|
39288
|
+
* xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
|
|
39289
|
+
* direct property writes succeed silently. Values are serialized verbatim when
|
|
39290
|
+
* `requireWellFormed` is false (the default). When the serializer is invoked with
|
|
39291
|
+
* `requireWellFormed: true` (via the 4th-parameter options object), it validates each
|
|
39292
|
+
* field and throws `DOMException` with code `INVALID_STATE_ERR` on invalid values.
|
|
39293
|
+
*
|
|
39294
|
+
* @class
|
|
39295
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentType MDN
|
|
39296
|
+
*/
|
|
39128
39297
|
function DocumentType() {
|
|
39129
39298
|
} DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
|
|
39130
39299
|
_extends(DocumentType,Node);
|
|
@@ -39152,11 +39321,48 @@ function requireDom () {
|
|
|
39152
39321
|
ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
|
|
39153
39322
|
_extends(ProcessingInstruction,Node);
|
|
39154
39323
|
function XMLSerializer(){}
|
|
39155
|
-
|
|
39156
|
-
|
|
39324
|
+
/**
|
|
39325
|
+
* Returns the result of serializing `node` to XML.
|
|
39326
|
+
*
|
|
39327
|
+
* When `options.requireWellFormed` is `true`, the serializer throws for content that would
|
|
39328
|
+
* produce ill-formed XML.
|
|
39329
|
+
*
|
|
39330
|
+
* __This implementation differs from the specification:__
|
|
39331
|
+
* - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
|
|
39332
|
+
* at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
|
|
39333
|
+
* default behaviour) unless `requireWellFormed` is `true`.
|
|
39334
|
+
* - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
|
|
39335
|
+
* is only thrown to prevent injection vectors, not for all the spec mandated checks.
|
|
39336
|
+
*
|
|
39337
|
+
* @param {Node} node
|
|
39338
|
+
* @param {boolean} [isHtml]
|
|
39339
|
+
* @param {function} [nodeFilter]
|
|
39340
|
+
* @param {Object} [options]
|
|
39341
|
+
* @param {boolean} [options.requireWellFormed=false]
|
|
39342
|
+
* When `true`, throws for content that would produce ill-formed XML.
|
|
39343
|
+
* @returns {string}
|
|
39344
|
+
* @throws {DOMException}
|
|
39345
|
+
* With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
|
|
39346
|
+
* - a CDATASection node's data contains `"]]>"`,
|
|
39347
|
+
* - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
|
|
39348
|
+
* - a ProcessingInstruction's data contains `"?>"`,
|
|
39349
|
+
* - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
|
|
39350
|
+
* production,
|
|
39351
|
+
* - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
|
|
39352
|
+
* production, or
|
|
39353
|
+
* - a DocumentType's `internalSubset` contains `"]>"`.
|
|
39354
|
+
* Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
|
|
39355
|
+
* writes succeed and are covered by the serializer-level checks above.
|
|
39356
|
+
* @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
|
|
39357
|
+
* @see https://w3c.github.io/DOM-Parsing/#xml-serialization
|
|
39358
|
+
* @see https://github.com/w3c/DOM-Parsing/issues/84
|
|
39359
|
+
*/
|
|
39360
|
+
XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter,options){
|
|
39361
|
+
return nodeSerializeToString.call(node,isHtml,nodeFilter,options);
|
|
39157
39362
|
};
|
|
39158
39363
|
Node.prototype.toString = nodeSerializeToString;
|
|
39159
|
-
function nodeSerializeToString(isHtml,nodeFilter){
|
|
39364
|
+
function nodeSerializeToString(isHtml,nodeFilter,options){
|
|
39365
|
+
var requireWellFormed = !!options && !!options.requireWellFormed;
|
|
39160
39366
|
var buf = [];
|
|
39161
39367
|
var refNode = this.nodeType == 9 && this.documentElement || this;
|
|
39162
39368
|
var prefix = refNode.prefix;
|
|
@@ -39173,7 +39379,7 @@ function requireDom () {
|
|
|
39173
39379
|
];
|
|
39174
39380
|
}
|
|
39175
39381
|
}
|
|
39176
|
-
serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
|
|
39382
|
+
serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces,requireWellFormed);
|
|
39177
39383
|
//console.log('###',this.nodeType,uri,prefix,buf.join(''))
|
|
39178
39384
|
return buf.join('');
|
|
39179
39385
|
}
|
|
@@ -39222,271 +39428,323 @@ function requireDom () {
|
|
|
39222
39428
|
buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
|
|
39223
39429
|
}
|
|
39224
39430
|
|
|
39225
|
-
function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
|
39431
|
+
function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
|
|
39226
39432
|
if (!visibleNamespaces) {
|
|
39227
39433
|
visibleNamespaces = [];
|
|
39228
39434
|
}
|
|
39229
|
-
|
|
39230
|
-
|
|
39231
|
-
|
|
39232
|
-
|
|
39233
|
-
|
|
39234
|
-
|
|
39235
|
-
|
|
39236
|
-
|
|
39237
|
-
|
|
39238
|
-
|
|
39239
|
-
|
|
39240
|
-
//buf.sort.apply(attrs, attributeSorter);
|
|
39241
|
-
}
|
|
39242
|
-
|
|
39243
|
-
switch(node.nodeType){
|
|
39244
|
-
case ELEMENT_NODE:
|
|
39245
|
-
var attrs = node.attributes;
|
|
39246
|
-
var len = attrs.length;
|
|
39247
|
-
var child = node.firstChild;
|
|
39248
|
-
var nodeName = node.tagName;
|
|
39249
|
-
|
|
39250
|
-
isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
|
|
39251
|
-
|
|
39252
|
-
var prefixedNodeName = nodeName;
|
|
39253
|
-
if (!isHTML && !node.prefix && node.namespaceURI) {
|
|
39254
|
-
var defaultNS;
|
|
39255
|
-
// lookup current default ns from `xmlns` attribute
|
|
39256
|
-
for (var ai = 0; ai < attrs.length; ai++) {
|
|
39257
|
-
if (attrs.item(ai).name === 'xmlns') {
|
|
39258
|
-
defaultNS = attrs.item(ai).value;
|
|
39259
|
-
break
|
|
39260
|
-
}
|
|
39261
|
-
}
|
|
39262
|
-
if (!defaultNS) {
|
|
39263
|
-
// lookup current default ns in visibleNamespaces
|
|
39264
|
-
for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
|
|
39265
|
-
var namespace = visibleNamespaces[nsi];
|
|
39266
|
-
if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
|
|
39267
|
-
defaultNS = namespace.namespace;
|
|
39268
|
-
break
|
|
39435
|
+
walkDOM(node, { ns: visibleNamespaces, isHTML: isHTML }, {
|
|
39436
|
+
enter: function (n, ctx) {
|
|
39437
|
+
var ns = ctx.ns;
|
|
39438
|
+
var html = ctx.isHTML;
|
|
39439
|
+
|
|
39440
|
+
if (nodeFilter) {
|
|
39441
|
+
n = nodeFilter(n);
|
|
39442
|
+
if (n) {
|
|
39443
|
+
if (typeof n == 'string') {
|
|
39444
|
+
buf.push(n);
|
|
39445
|
+
return null;
|
|
39269
39446
|
}
|
|
39447
|
+
} else {
|
|
39448
|
+
return null;
|
|
39270
39449
|
}
|
|
39271
39450
|
}
|
|
39272
|
-
|
|
39273
|
-
|
|
39274
|
-
|
|
39275
|
-
|
|
39276
|
-
|
|
39277
|
-
|
|
39451
|
+
|
|
39452
|
+
switch (n.nodeType) {
|
|
39453
|
+
case ELEMENT_NODE:
|
|
39454
|
+
var attrs = n.attributes;
|
|
39455
|
+
var len = attrs.length;
|
|
39456
|
+
var nodeName = n.tagName;
|
|
39457
|
+
|
|
39458
|
+
html = NAMESPACE.isHTML(n.namespaceURI) || html;
|
|
39459
|
+
|
|
39460
|
+
var prefixedNodeName = nodeName;
|
|
39461
|
+
if (!html && !n.prefix && n.namespaceURI) {
|
|
39462
|
+
var defaultNS;
|
|
39463
|
+
// lookup current default ns from `xmlns` attribute
|
|
39464
|
+
for (var ai = 0; ai < attrs.length; ai++) {
|
|
39465
|
+
if (attrs.item(ai).name === 'xmlns') {
|
|
39466
|
+
defaultNS = attrs.item(ai).value;
|
|
39467
|
+
break;
|
|
39468
|
+
}
|
|
39469
|
+
}
|
|
39470
|
+
if (!defaultNS) {
|
|
39471
|
+
// lookup current default ns in visibleNamespaces
|
|
39472
|
+
for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
|
|
39473
|
+
var nsEntry = ns[nsi];
|
|
39474
|
+
if (nsEntry.prefix === '' && nsEntry.namespace === n.namespaceURI) {
|
|
39475
|
+
defaultNS = nsEntry.namespace;
|
|
39476
|
+
break;
|
|
39477
|
+
}
|
|
39478
|
+
}
|
|
39479
|
+
}
|
|
39480
|
+
if (defaultNS !== n.namespaceURI) {
|
|
39481
|
+
for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
|
|
39482
|
+
var nsEntry = ns[nsi];
|
|
39483
|
+
if (nsEntry.namespace === n.namespaceURI) {
|
|
39484
|
+
if (nsEntry.prefix) {
|
|
39485
|
+
prefixedNodeName = nsEntry.prefix + ':' + nodeName;
|
|
39486
|
+
}
|
|
39487
|
+
break;
|
|
39488
|
+
}
|
|
39489
|
+
}
|
|
39278
39490
|
}
|
|
39279
|
-
break
|
|
39280
39491
|
}
|
|
39281
|
-
}
|
|
39282
|
-
}
|
|
39283
|
-
}
|
|
39284
39492
|
|
|
39285
|
-
|
|
39493
|
+
buf.push('<', prefixedNodeName);
|
|
39494
|
+
|
|
39495
|
+
// Build a fresh namespace snapshot for this element's children.
|
|
39496
|
+
// The slice prevents sibling elements from inheriting each other's declarations.
|
|
39497
|
+
var childNs = ns.slice();
|
|
39498
|
+
for (var i = 0; i < len; i++) {
|
|
39499
|
+
var attr = attrs.item(i);
|
|
39500
|
+
if (attr.prefix == 'xmlns') {
|
|
39501
|
+
childNs.push({ prefix: attr.localName, namespace: attr.value });
|
|
39502
|
+
} else if (attr.nodeName == 'xmlns') {
|
|
39503
|
+
childNs.push({ prefix: '', namespace: attr.value });
|
|
39504
|
+
}
|
|
39505
|
+
}
|
|
39286
39506
|
|
|
39287
|
-
|
|
39288
|
-
|
|
39289
|
-
|
|
39290
|
-
|
|
39291
|
-
|
|
39292
|
-
|
|
39293
|
-
|
|
39294
|
-
|
|
39295
|
-
|
|
39507
|
+
for (var i = 0; i < len; i++) {
|
|
39508
|
+
var attr = attrs.item(i);
|
|
39509
|
+
if (needNamespaceDefine(attr, html, childNs)) {
|
|
39510
|
+
var attrPrefix = attr.prefix || '';
|
|
39511
|
+
var uri = attr.namespaceURI;
|
|
39512
|
+
addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri);
|
|
39513
|
+
childNs.push({ prefix: attrPrefix, namespace: uri });
|
|
39514
|
+
}
|
|
39515
|
+
// Apply nodeFilter and serialize the attribute.
|
|
39516
|
+
var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
|
|
39517
|
+
if (filteredAttr) {
|
|
39518
|
+
if (typeof filteredAttr === 'string') {
|
|
39519
|
+
buf.push(filteredAttr);
|
|
39520
|
+
} else {
|
|
39521
|
+
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
|
|
39522
|
+
}
|
|
39523
|
+
}
|
|
39524
|
+
}
|
|
39296
39525
|
|
|
39297
|
-
|
|
39298
|
-
|
|
39299
|
-
|
|
39300
|
-
|
|
39301
|
-
|
|
39302
|
-
|
|
39303
|
-
|
|
39304
|
-
}
|
|
39305
|
-
serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
|
|
39306
|
-
}
|
|
39526
|
+
// add namespace for current node
|
|
39527
|
+
if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
|
|
39528
|
+
var nodePrefix = n.prefix || '';
|
|
39529
|
+
var uri = n.namespaceURI;
|
|
39530
|
+
addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri);
|
|
39531
|
+
childNs.push({ prefix: nodePrefix, namespace: uri });
|
|
39532
|
+
}
|
|
39307
39533
|
|
|
39308
|
-
|
|
39309
|
-
|
|
39310
|
-
|
|
39311
|
-
|
|
39312
|
-
|
|
39313
|
-
|
|
39314
|
-
|
|
39534
|
+
var child = n.firstChild;
|
|
39535
|
+
if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
|
|
39536
|
+
buf.push('>');
|
|
39537
|
+
if (html && /^script$/i.test(nodeName)) {
|
|
39538
|
+
// Inline serialization for <script> children; return null to skip walkDOM descent.
|
|
39539
|
+
while (child) {
|
|
39540
|
+
if (child.data) {
|
|
39541
|
+
buf.push(child.data);
|
|
39542
|
+
} else {
|
|
39543
|
+
serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
|
|
39544
|
+
}
|
|
39545
|
+
child = child.nextSibling;
|
|
39546
|
+
}
|
|
39547
|
+
buf.push('</', nodeName, '>');
|
|
39548
|
+
return null;
|
|
39549
|
+
}
|
|
39550
|
+
// Return child context; walkDOM descends and exit emits the closing tag.
|
|
39551
|
+
return { ns: childNs, isHTML: html, tag: prefixedNodeName };
|
|
39552
|
+
} else {
|
|
39553
|
+
buf.push('/>');
|
|
39554
|
+
return null;
|
|
39555
|
+
}
|
|
39315
39556
|
|
|
39316
|
-
|
|
39317
|
-
|
|
39318
|
-
|
|
39319
|
-
|
|
39320
|
-
|
|
39321
|
-
|
|
39322
|
-
|
|
39323
|
-
|
|
39324
|
-
|
|
39557
|
+
case DOCUMENT_NODE:
|
|
39558
|
+
case DOCUMENT_FRAGMENT_NODE:
|
|
39559
|
+
// Descend into children; exit is a no-op (tag is null).
|
|
39560
|
+
return { ns: ns.slice(), isHTML: html, tag: null };
|
|
39561
|
+
|
|
39562
|
+
case ATTRIBUTE_NODE:
|
|
39563
|
+
addSerializedAttribute(buf, n.name, n.value);
|
|
39564
|
+
return null;
|
|
39565
|
+
|
|
39566
|
+
case TEXT_NODE:
|
|
39567
|
+
/**
|
|
39568
|
+
* The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
|
|
39569
|
+
* except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
|
|
39570
|
+
* If they are needed elsewhere, they must be escaped using either numeric character references or the strings
|
|
39571
|
+
* `&` and `<` respectively.
|
|
39572
|
+
* The right angle bracket (>) may be represented using the string " > ", and must, for compatibility,
|
|
39573
|
+
* be escaped using either `>` or a character reference when it appears in the string `]]>` in content,
|
|
39574
|
+
* when that string is not marking the end of a CDATA section.
|
|
39575
|
+
*
|
|
39576
|
+
* In the content of elements, character data is any string of characters
|
|
39577
|
+
* which does not contain the start-delimiter of any markup
|
|
39578
|
+
* and does not include the CDATA-section-close delimiter, `]]>`.
|
|
39579
|
+
*
|
|
39580
|
+
* @see https://www.w3.org/TR/xml/#NT-CharData
|
|
39581
|
+
* @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
|
|
39582
|
+
*/
|
|
39583
|
+
buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
|
|
39584
|
+
return null;
|
|
39585
|
+
|
|
39586
|
+
case CDATA_SECTION_NODE:
|
|
39587
|
+
if (requireWellFormed && n.data.indexOf(']]>') !== -1) {
|
|
39588
|
+
throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
|
|
39325
39589
|
}
|
|
39326
|
-
|
|
39327
|
-
|
|
39328
|
-
|
|
39329
|
-
|
|
39330
|
-
|
|
39331
|
-
|
|
39332
|
-
|
|
39333
|
-
|
|
39334
|
-
|
|
39335
|
-
|
|
39336
|
-
|
|
39337
|
-
|
|
39338
|
-
|
|
39339
|
-
|
|
39340
|
-
|
|
39341
|
-
|
|
39342
|
-
|
|
39343
|
-
|
|
39344
|
-
|
|
39345
|
-
|
|
39346
|
-
|
|
39347
|
-
|
|
39348
|
-
|
|
39349
|
-
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39353
|
-
|
|
39354
|
-
|
|
39355
|
-
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
|
|
39361
|
-
|
|
39362
|
-
|
|
39363
|
-
|
|
39364
|
-
|
|
39365
|
-
|
|
39366
|
-
|
|
39367
|
-
|
|
39368
|
-
|
|
39369
|
-
|
|
39370
|
-
|
|
39371
|
-
|
|
39372
|
-
|
|
39373
|
-
|
|
39374
|
-
|
|
39375
|
-
|
|
39376
|
-
|
|
39377
|
-
|
|
39378
|
-
|
|
39379
|
-
|
|
39380
|
-
|
|
39381
|
-
|
|
39382
|
-
|
|
39383
|
-
|
|
39590
|
+
buf.push('<![CDATA[', n.data.replace(/]]>/g, ']]]]><![CDATA[>'), ']]>');
|
|
39591
|
+
return null;
|
|
39592
|
+
|
|
39593
|
+
case COMMENT_NODE:
|
|
39594
|
+
if (requireWellFormed && n.data.indexOf('-->') !== -1) {
|
|
39595
|
+
throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
|
|
39596
|
+
}
|
|
39597
|
+
buf.push('<!--', n.data, '-->');
|
|
39598
|
+
return null;
|
|
39599
|
+
|
|
39600
|
+
case DOCUMENT_TYPE_NODE:
|
|
39601
|
+
if (requireWellFormed) {
|
|
39602
|
+
if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
|
|
39603
|
+
throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
|
|
39604
|
+
}
|
|
39605
|
+
if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
|
|
39606
|
+
throw new DOMException(INVALID_STATE_ERR, 'DocumentType systemId is not a valid SystemLiteral');
|
|
39607
|
+
}
|
|
39608
|
+
if (n.internalSubset && n.internalSubset.indexOf(']>') !== -1) {
|
|
39609
|
+
throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
|
|
39610
|
+
}
|
|
39611
|
+
}
|
|
39612
|
+
var pubid = n.publicId;
|
|
39613
|
+
var sysid = n.systemId;
|
|
39614
|
+
buf.push('<!DOCTYPE ', n.name);
|
|
39615
|
+
if (pubid) {
|
|
39616
|
+
buf.push(' PUBLIC ', pubid);
|
|
39617
|
+
if (sysid && sysid != '.') {
|
|
39618
|
+
buf.push(' ', sysid);
|
|
39619
|
+
}
|
|
39620
|
+
buf.push('>');
|
|
39621
|
+
} else if (sysid && sysid != '.') {
|
|
39622
|
+
buf.push(' SYSTEM ', sysid, '>');
|
|
39623
|
+
} else {
|
|
39624
|
+
var sub = n.internalSubset;
|
|
39625
|
+
if (sub) {
|
|
39626
|
+
buf.push(' [', sub, ']');
|
|
39627
|
+
}
|
|
39628
|
+
buf.push('>');
|
|
39629
|
+
}
|
|
39630
|
+
return null;
|
|
39631
|
+
|
|
39632
|
+
case PROCESSING_INSTRUCTION_NODE:
|
|
39633
|
+
if (requireWellFormed && n.data.indexOf('?>') !== -1) {
|
|
39634
|
+
throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
|
|
39635
|
+
}
|
|
39636
|
+
buf.push('<?', n.target, ' ', n.data, '?>');
|
|
39637
|
+
return null;
|
|
39638
|
+
|
|
39639
|
+
case ENTITY_REFERENCE_NODE:
|
|
39640
|
+
buf.push('&', n.nodeName, ';');
|
|
39641
|
+
return null;
|
|
39642
|
+
|
|
39643
|
+
//case ENTITY_NODE:
|
|
39644
|
+
//case NOTATION_NODE:
|
|
39645
|
+
default:
|
|
39646
|
+
buf.push('??', n.nodeName);
|
|
39647
|
+
return null;
|
|
39384
39648
|
}
|
|
39385
|
-
|
|
39386
|
-
|
|
39387
|
-
|
|
39388
|
-
|
|
39389
|
-
var sub = node.internalSubset;
|
|
39390
|
-
if(sub){
|
|
39391
|
-
buf.push(" [",sub,"]");
|
|
39649
|
+
},
|
|
39650
|
+
exit: function (n, childCtx) {
|
|
39651
|
+
if (childCtx && childCtx.tag) {
|
|
39652
|
+
buf.push('</', childCtx.tag, '>');
|
|
39392
39653
|
}
|
|
39393
|
-
|
|
39394
|
-
|
|
39395
|
-
return;
|
|
39396
|
-
case PROCESSING_INSTRUCTION_NODE:
|
|
39397
|
-
return buf.push( "<?",node.target," ",node.data,"?>");
|
|
39398
|
-
case ENTITY_REFERENCE_NODE:
|
|
39399
|
-
return buf.push( '&',node.nodeName,';');
|
|
39400
|
-
//case ENTITY_NODE:
|
|
39401
|
-
//case NOTATION_NODE:
|
|
39402
|
-
default:
|
|
39403
|
-
buf.push('??',node.nodeName);
|
|
39404
|
-
}
|
|
39654
|
+
},
|
|
39655
|
+
});
|
|
39405
39656
|
}
|
|
39406
|
-
|
|
39407
|
-
|
|
39408
|
-
|
|
39409
|
-
|
|
39410
|
-
|
|
39411
|
-
|
|
39412
|
-
|
|
39413
|
-
|
|
39414
|
-
|
|
39415
|
-
|
|
39416
|
-
|
|
39417
|
-
|
|
39418
|
-
|
|
39419
|
-
|
|
39420
|
-
|
|
39421
|
-
|
|
39422
|
-
|
|
39423
|
-
|
|
39424
|
-
|
|
39425
|
-
|
|
39426
|
-
|
|
39427
|
-
|
|
39428
|
-
|
|
39429
|
-
|
|
39430
|
-
|
|
39431
|
-
|
|
39432
|
-
|
|
39433
|
-
|
|
39434
|
-
|
|
39435
|
-
|
|
39436
|
-
|
|
39437
|
-
|
|
39438
|
-
|
|
39439
|
-
|
|
39440
|
-
|
|
39441
|
-
|
|
39442
|
-
|
|
39443
|
-
var child = node.firstChild;
|
|
39444
|
-
while(child){
|
|
39445
|
-
node2.appendChild(importNode(doc,child,deep));
|
|
39446
|
-
child = child.nextSibling;
|
|
39447
|
-
}
|
|
39448
|
-
}
|
|
39449
|
-
return node2;
|
|
39657
|
+
/**
|
|
39658
|
+
* Imports a node from a different document into `doc`, creating a new copy.
|
|
39659
|
+
* Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
|
|
39660
|
+
* stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
|
|
39661
|
+
* Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
|
|
39662
|
+
* always forced to `true`
|
|
39663
|
+
* because an attribute's value lives in a child text node.
|
|
39664
|
+
*
|
|
39665
|
+
* @param {Document} doc
|
|
39666
|
+
* The document that will own the imported node.
|
|
39667
|
+
* @param {Node} node
|
|
39668
|
+
* The node to import.
|
|
39669
|
+
* @param {boolean} deep
|
|
39670
|
+
* If `true`, descendants are imported recursively.
|
|
39671
|
+
* @returns {Node}
|
|
39672
|
+
* The newly imported node, now owned by `doc`.
|
|
39673
|
+
*/
|
|
39674
|
+
function importNode(doc, node, deep) {
|
|
39675
|
+
var destRoot;
|
|
39676
|
+
walkDOM(node, null, {
|
|
39677
|
+
enter: function (srcNode, destParent) {
|
|
39678
|
+
// Shallow-clone the node and stamp it into the target document.
|
|
39679
|
+
var destNode = srcNode.cloneNode(false);
|
|
39680
|
+
destNode.ownerDocument = doc;
|
|
39681
|
+
destNode.parentNode = null;
|
|
39682
|
+
// capture as the root of the imported subtree or attach to parent.
|
|
39683
|
+
if (destParent === null) {
|
|
39684
|
+
destRoot = destNode;
|
|
39685
|
+
} else {
|
|
39686
|
+
destParent.appendChild(destNode);
|
|
39687
|
+
}
|
|
39688
|
+
// ATTRIBUTE_NODE must always be imported deeply: its value lives in a child text node.
|
|
39689
|
+
var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
|
|
39690
|
+
return shouldDeep ? destNode : null;
|
|
39691
|
+
},
|
|
39692
|
+
});
|
|
39693
|
+
return destRoot;
|
|
39450
39694
|
}
|
|
39451
39695
|
//
|
|
39452
39696
|
//var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
|
|
39453
39697
|
// attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
|
|
39454
|
-
function cloneNode(doc,node,deep){
|
|
39455
|
-
var
|
|
39456
|
-
|
|
39457
|
-
|
|
39458
|
-
|
|
39459
|
-
|
|
39460
|
-
|
|
39461
|
-
|
|
39698
|
+
function cloneNode(doc, node, deep) {
|
|
39699
|
+
var destRoot;
|
|
39700
|
+
walkDOM(node, null, {
|
|
39701
|
+
enter: function (srcNode, destParent) {
|
|
39702
|
+
// 1. Create a blank node of the same type and copy all scalar own properties.
|
|
39703
|
+
var destNode = new srcNode.constructor();
|
|
39704
|
+
for (var n in srcNode) {
|
|
39705
|
+
if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
|
|
39706
|
+
var v = srcNode[n];
|
|
39707
|
+
if (typeof v != 'object') {
|
|
39708
|
+
if (v != destNode[n]) {
|
|
39709
|
+
destNode[n] = v;
|
|
39710
|
+
}
|
|
39711
|
+
}
|
|
39462
39712
|
}
|
|
39463
39713
|
}
|
|
39464
|
-
|
|
39465
|
-
|
|
39466
|
-
|
|
39467
|
-
|
|
39468
|
-
|
|
39469
|
-
|
|
39470
|
-
|
|
39471
|
-
|
|
39472
|
-
|
|
39473
|
-
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
|
|
39477
|
-
|
|
39478
|
-
|
|
39479
|
-
|
|
39480
|
-
|
|
39481
|
-
|
|
39482
|
-
|
|
39483
|
-
|
|
39484
|
-
|
|
39485
|
-
|
|
39486
|
-
|
|
39487
|
-
|
|
39488
|
-
|
|
39489
|
-
|
|
39714
|
+
if (srcNode.childNodes) {
|
|
39715
|
+
destNode.childNodes = new NodeList();
|
|
39716
|
+
}
|
|
39717
|
+
destNode.ownerDocument = doc;
|
|
39718
|
+
// 2. Handle node-type-specific setup.
|
|
39719
|
+
// Attributes are not DOM children, so they are cloned inline here
|
|
39720
|
+
// rather than by walkDOM descent.
|
|
39721
|
+
// ATTRIBUTE_NODE forces deep=true so its own children are walked.
|
|
39722
|
+
var shouldDeep = deep;
|
|
39723
|
+
switch (destNode.nodeType) {
|
|
39724
|
+
case ELEMENT_NODE:
|
|
39725
|
+
var attrs = srcNode.attributes;
|
|
39726
|
+
var attrs2 = (destNode.attributes = new NamedNodeMap());
|
|
39727
|
+
var len = attrs.length;
|
|
39728
|
+
attrs2._ownerElement = destNode;
|
|
39729
|
+
for (var i = 0; i < len; i++) {
|
|
39730
|
+
destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
|
|
39731
|
+
}
|
|
39732
|
+
break;
|
|
39733
|
+
case ATTRIBUTE_NODE:
|
|
39734
|
+
shouldDeep = true;
|
|
39735
|
+
}
|
|
39736
|
+
// 3. Attach to parent, or capture as the root of the cloned subtree.
|
|
39737
|
+
if (destParent !== null) {
|
|
39738
|
+
destParent.appendChild(destNode);
|
|
39739
|
+
} else {
|
|
39740
|
+
destRoot = destNode;
|
|
39741
|
+
}
|
|
39742
|
+
// 4. Return destNode as the context for children (causes walkDOM to descend),
|
|
39743
|
+
// or null to skip children (shallow clone).
|
|
39744
|
+
return shouldDeep ? destNode : null;
|
|
39745
|
+
},
|
|
39746
|
+
});
|
|
39747
|
+
return destRoot;
|
|
39490
39748
|
}
|
|
39491
39749
|
|
|
39492
39750
|
function __set__(object,key,value){
|
|
@@ -39502,49 +39760,55 @@ function requireDom () {
|
|
|
39502
39760
|
}
|
|
39503
39761
|
});
|
|
39504
39762
|
|
|
39505
|
-
|
|
39506
|
-
|
|
39507
|
-
|
|
39763
|
+
/**
|
|
39764
|
+
* The text content of this node and its descendants.
|
|
39765
|
+
*
|
|
39766
|
+
* Setting `textContent` on an element or document fragment replaces all child nodes with a
|
|
39767
|
+
* single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
|
|
39768
|
+
*
|
|
39769
|
+
* @type {string | null}
|
|
39770
|
+
* @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
|
|
39771
|
+
*/
|
|
39772
|
+
Object.defineProperty(Node.prototype, 'textContent', {
|
|
39773
|
+
get: function () {
|
|
39774
|
+
if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
|
39775
|
+
var buf = [];
|
|
39776
|
+
walkDOM(this, null, {
|
|
39777
|
+
enter: function (n) {
|
|
39778
|
+
if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
|
39779
|
+
return true; // enter children
|
|
39780
|
+
}
|
|
39781
|
+
if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
|
|
39782
|
+
return null; // excluded from text content
|
|
39783
|
+
}
|
|
39784
|
+
buf.push(n.nodeValue);
|
|
39785
|
+
},
|
|
39786
|
+
});
|
|
39787
|
+
return buf.join('');
|
|
39788
|
+
}
|
|
39789
|
+
return this.nodeValue;
|
|
39508
39790
|
},
|
|
39509
39791
|
|
|
39510
|
-
set:function(data){
|
|
39511
|
-
switch(this.nodeType){
|
|
39512
|
-
|
|
39513
|
-
|
|
39514
|
-
|
|
39515
|
-
|
|
39516
|
-
|
|
39517
|
-
|
|
39518
|
-
|
|
39519
|
-
|
|
39520
|
-
|
|
39792
|
+
set: function (data) {
|
|
39793
|
+
switch (this.nodeType) {
|
|
39794
|
+
case ELEMENT_NODE:
|
|
39795
|
+
case DOCUMENT_FRAGMENT_NODE:
|
|
39796
|
+
while (this.firstChild) {
|
|
39797
|
+
this.removeChild(this.firstChild);
|
|
39798
|
+
}
|
|
39799
|
+
if (data || String(data)) {
|
|
39800
|
+
this.appendChild(this.ownerDocument.createTextNode(data));
|
|
39801
|
+
}
|
|
39802
|
+
break;
|
|
39521
39803
|
|
|
39522
|
-
|
|
39523
|
-
|
|
39524
|
-
|
|
39525
|
-
|
|
39804
|
+
default:
|
|
39805
|
+
this.data = data;
|
|
39806
|
+
this.value = data;
|
|
39807
|
+
this.nodeValue = data;
|
|
39526
39808
|
}
|
|
39527
|
-
}
|
|
39809
|
+
},
|
|
39528
39810
|
});
|
|
39529
39811
|
|
|
39530
|
-
function getTextContent(node){
|
|
39531
|
-
switch(node.nodeType){
|
|
39532
|
-
case ELEMENT_NODE:
|
|
39533
|
-
case DOCUMENT_FRAGMENT_NODE:
|
|
39534
|
-
var buf = [];
|
|
39535
|
-
node = node.firstChild;
|
|
39536
|
-
while(node){
|
|
39537
|
-
if(node.nodeType!==7 && node.nodeType !==8){
|
|
39538
|
-
buf.push(getTextContent(node));
|
|
39539
|
-
}
|
|
39540
|
-
node = node.nextSibling;
|
|
39541
|
-
}
|
|
39542
|
-
return buf.join('');
|
|
39543
|
-
default:
|
|
39544
|
-
return node.nodeValue;
|
|
39545
|
-
}
|
|
39546
|
-
}
|
|
39547
|
-
|
|
39548
39812
|
__set__ = function(object,key,value){
|
|
39549
39813
|
//console.log(value)
|
|
39550
39814
|
object['$$'+key] = value;
|
|
@@ -39560,6 +39824,7 @@ function requireDom () {
|
|
|
39560
39824
|
dom.Element = Element;
|
|
39561
39825
|
dom.Node = Node;
|
|
39562
39826
|
dom.NodeList = NodeList;
|
|
39827
|
+
dom.walkDOM = walkDOM;
|
|
39563
39828
|
dom.XMLSerializer = XMLSerializer;
|
|
39564
39829
|
//}
|
|
39565
39830
|
return dom;
|
|
@@ -42350,7 +42615,7 @@ function requireSax () {
|
|
|
42350
42615
|
function parseInstruction(source,start,domBuilder){
|
|
42351
42616
|
var end = source.indexOf('?>',start);
|
|
42352
42617
|
if(end){
|
|
42353
|
-
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)
|
|
42618
|
+
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
|
|
42354
42619
|
if(match){
|
|
42355
42620
|
match[0].length;
|
|
42356
42621
|
domBuilder.processingInstruction(match[1], match[2]) ;
|