@wavemaker/angular-app 11.14.1-21.64739 → 11.14.1-21.64741

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.
@@ -131320,14 +131320,14 @@ function requireDom$1 () {
131320
131320
  ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
131321
131321
  var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
131322
131322
  ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
131323
- ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
131323
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
131324
131324
  ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
131325
131325
  ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
131326
131326
  var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
131327
131327
  ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
131328
131328
  var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
131329
131329
  //level2
131330
- ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
131330
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
131331
131331
  ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
131332
131332
  ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
131333
131333
  ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
@@ -131377,9 +131377,10 @@ function requireDom$1 () {
131377
131377
  item: function(index) {
131378
131378
  return index >= 0 && index < this.length ? this[index] : null;
131379
131379
  },
131380
- toString:function(isHTML,nodeFilter){
131380
+ toString:function(isHTML,nodeFilter,options){
131381
+ var requireWellFormed = !!options && !!options.requireWellFormed;
131381
131382
  for(var buf = [], i = 0;i<this.length;i++){
131382
- serializeToString(this[i],buf,isHTML,nodeFilter);
131383
+ serializeToString(this[i],buf,isHTML,nodeFilter,null,requireWellFormed);
131383
131384
  }
131384
131385
  return buf.join('');
131385
131386
  },
@@ -131624,13 +131625,28 @@ function requireDom$1 () {
131624
131625
  /**
131625
131626
  * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
131626
131627
  *
131627
- * __This behavior is slightly different from the in the specs__:
131628
+ * __This implementation differs from the specification:__
131628
131629
  * - this implementation is not validating names or qualified names
131629
131630
  * (when parsing XML strings, the SAX parser takes care of that)
131630
131631
  *
131632
+ * Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
131633
+ * Creation-time validation of `publicId`, `systemId` is not enforced.
131634
+ * The serializer-level check covers all mutation vectors, including direct property writes.
131635
+ * `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
131636
+ * absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
131637
+ * silently omitted from the serialized output.
131638
+ *
131631
131639
  * @param {string} qualifiedName
131632
131640
  * @param {string} [publicId]
131641
+ * The external subset public identifier. Stored verbatim including surrounding quotes.
131642
+ * When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
131643
+ * throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
131644
+ * not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
131633
131645
  * @param {string} [systemId]
131646
+ * The external subset system identifier. Stored verbatim including surrounding quotes.
131647
+ * When serialized with `requireWellFormed: true`, throws `DOMException` with code
131648
+ * `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
131649
+ * production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
131634
131650
  * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
131635
131651
  * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
131636
131652
  *
@@ -131696,18 +131712,44 @@ function requireDom$1 () {
131696
131712
  return cloneNode(this.ownerDocument||this,this,deep);
131697
131713
  },
131698
131714
  // Modified in DOM Level 2:
131699
- normalize:function(){
131700
- var child = this.firstChild;
131701
- while(child){
131702
- var next = child.nextSibling;
131703
- if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
131704
- this.removeChild(next);
131705
- child.appendData(next.data);
131706
- }else {
131707
- child.normalize();
131708
- child = next;
131709
- }
131710
- }
131715
+ /**
131716
+ * Puts the specified node and all of its subtree into a "normalized" form. In a normalized
131717
+ * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
131718
+ *
131719
+ * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
131720
+ * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
131721
+ * nodes.
131722
+ *
131723
+ * This method iteratively traverses all child nodes to normalize all descendant nodes within
131724
+ * the subtree.
131725
+ *
131726
+ * @throws {DOMException}
131727
+ * May throw a DOMException if operations within removeChild or appendData (which are
131728
+ * potentially invoked in this method) do not meet their specific constraints.
131729
+ * @see {@link Node.removeChild}
131730
+ * @see {@link CharacterData.appendData}
131731
+ * @see ../docs/walk-dom.md.
131732
+ */
131733
+ normalize: function () {
131734
+ walkDOM(this, null, {
131735
+ enter: function (node) {
131736
+ // Merge adjacent text children of node before walkDOM schedules them.
131737
+ // walkDOM reads lastChild/previousSibling after enter returns, so the
131738
+ // surviving post-merge children are what it descends into.
131739
+ var child = node.firstChild;
131740
+ while (child) {
131741
+ var next = child.nextSibling;
131742
+ if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
131743
+ node.removeChild(next);
131744
+ child.appendData(next.data);
131745
+ // Do not advance child: re-check new nextSibling for another text run
131746
+ } else {
131747
+ child = next;
131748
+ }
131749
+ }
131750
+ return true; // descend into surviving children
131751
+ },
131752
+ });
131711
131753
  },
131712
131754
  // Introduced in DOM Level 2:
131713
131755
  isSupported:function(feature, version){
@@ -131783,21 +131825,103 @@ function requireDom$1 () {
131783
131825
  copy(NodeType,Node.prototype);
131784
131826
 
131785
131827
  /**
131786
- * @param callback return true for continue,false for break
131787
- * @return boolean true: break visit;
131828
+ * @param {Node} node
131829
+ * Root of the subtree to visit.
131830
+ * @param {function(Node): boolean} callback
131831
+ * Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
131832
+ * @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
131788
131833
  */
131789
- function _visitNode(node,callback){
131790
- if(callback(node)){
131791
- return true;
131792
- }
131793
- if(node = node.firstChild){
131794
- do{
131795
- if(_visitNode(node,callback)){return true}
131796
- }while(node=node.nextSibling)
131797
- }
131834
+ function _visitNode(node, callback) {
131835
+ return walkDOM(node, null, { enter: function (n) { return callback(n) ? walkDOM.STOP : true; } }) === walkDOM.STOP;
131798
131836
  }
131799
131837
 
131838
+ /**
131839
+ * Depth-first pre/post-order DOM tree walker.
131840
+ *
131841
+ * Visits every node in the subtree rooted at `node`. For each node:
131842
+ *
131843
+ * 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
131844
+ * return value becomes the `context` passed to each child's `enter` call and to the matching
131845
+ * `exit` call.
131846
+ * 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
131847
+ * sibling traversal continues normally.
131848
+ * 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
131849
+ * further `enter` or `exit` calls are made.
131850
+ * 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
131851
+ * safely modify the node's own child list before the walker descends. Modifying siblings of
131852
+ * the current node or any other part of the tree produces unpredictable results: nodes already
131853
+ * queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
131854
+ * the current child list are never visited.
131855
+ * 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
131856
+ * been visited, passing the same `context` that `enter`
131857
+ * returned for that node.
131858
+ *
131859
+ * This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
131860
+ * deep trees.
131861
+ *
131862
+ * @param {Node} node
131863
+ * Root of the subtree to walk.
131864
+ * @param {*} context
131865
+ * Initial context value passed to the root node's `enter`.
131866
+ * @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
131867
+ * @returns {void | walkDOM.STOP}
131868
+ * @see ../docs/walk-dom.md.
131869
+ */
131870
+ function walkDOM(node, context, callbacks) {
131871
+ // Each stack frame is {node, context, phase}:
131872
+ // walkDOM.ENTER — call enter, then push children
131873
+ // walkDOM.EXIT — call exit
131874
+ var stack = [{ node: node, context: context, phase: walkDOM.ENTER }];
131875
+ while (stack.length > 0) {
131876
+ var frame = stack.pop();
131877
+ if (frame.phase === walkDOM.ENTER) {
131878
+ var childContext = callbacks.enter(frame.node, frame.context);
131879
+ if (childContext === walkDOM.STOP) {
131880
+ return walkDOM.STOP;
131881
+ }
131882
+ // Push exit frame before children so it fires after all children are processed (Last In First Out)
131883
+ stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
131884
+ if (childContext === null || childContext === undefined) {
131885
+ continue; // skip children
131886
+ }
131887
+ // lastChild is read after enter returns, so enter may modify the child list.
131888
+ var child = frame.node.lastChild;
131889
+ // Traverse from lastChild backwards so that pushing onto the stack
131890
+ // naturally yields firstChild on top (processed first).
131891
+ while (child) {
131892
+ stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
131893
+ child = child.previousSibling;
131894
+ }
131895
+ } else {
131896
+ // frame.phase === walkDOM.EXIT
131897
+ if (callbacks.exit) {
131898
+ callbacks.exit(frame.node, frame.context);
131899
+ }
131900
+ }
131901
+ }
131902
+ }
131800
131903
 
131904
+ /**
131905
+ * Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
131906
+ * immediately.
131907
+ *
131908
+ * @type {symbol}
131909
+ */
131910
+ walkDOM.STOP = Symbol('walkDOM.STOP');
131911
+ /**
131912
+ * Phase constant for a stack frame that has not yet been visited.
131913
+ * The `enter` callback is called and children are scheduled.
131914
+ *
131915
+ * @type {number}
131916
+ */
131917
+ walkDOM.ENTER = 0;
131918
+ /**
131919
+ * Phase constant for a stack frame whose subtree has been fully visited.
131920
+ * The `exit` callback is called.
131921
+ *
131922
+ * @type {number}
131923
+ */
131924
+ walkDOM.EXIT = 1;
131801
131925
 
131802
131926
  function Document(){
131803
131927
  this.ownerDocument = this;
@@ -132401,12 +132525,44 @@ function requireDom$1 () {
132401
132525
  node.appendData(data);
132402
132526
  return node;
132403
132527
  },
132528
+ /**
132529
+ * Returns a new CDATASection node whose data is `data`.
132530
+ *
132531
+ * __This implementation differs from the specification:__
132532
+ * - calling this method on an HTML document does not throw `NotSupportedError`.
132533
+ *
132534
+ * @param {string} data
132535
+ * @returns {CDATASection}
132536
+ * @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
132537
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
132538
+ * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
132539
+ */
132404
132540
  createCDATASection : function(data){
132541
+ if (data.indexOf(']]>') !== -1) {
132542
+ throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
132543
+ }
132405
132544
  var node = new CDATASection();
132406
132545
  node.ownerDocument = this;
132407
132546
  node.appendData(data);
132408
132547
  return node;
132409
132548
  },
132549
+ /**
132550
+ * Returns a ProcessingInstruction node whose target is target and data is data.
132551
+ *
132552
+ * __This implementation differs from the specification:__
132553
+ * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
132554
+ *
132555
+ * Note: When the resulting document is serialized with `requireWellFormed: true`, the
132556
+ * serializer throws with code `INVALID_STATE_ERR` if `.data` contains `?>` (W3C DOM Parsing
132557
+ * §3.2.1.7). Without that option the data is emitted verbatim.
132558
+ *
132559
+ * @param {string} target
132560
+ * @param {string} data
132561
+ * @returns {ProcessingInstruction}
132562
+ * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
132563
+ * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
132564
+ * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
132565
+ */
132410
132566
  createProcessingInstruction : function(target,data){
132411
132567
  var node = new ProcessingInstruction();
132412
132568
  node.ownerDocument = this;
@@ -132632,6 +132788,19 @@ function requireDom$1 () {
132632
132788
  _extends(CDATASection,CharacterData);
132633
132789
 
132634
132790
 
132791
+ /**
132792
+ * Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
132793
+ *
132794
+ * `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
132795
+ * xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
132796
+ * direct property writes succeed silently. Values are serialized verbatim when
132797
+ * `requireWellFormed` is false (the default). When the serializer is invoked with
132798
+ * `requireWellFormed: true` (via the 4th-parameter options object), it validates each
132799
+ * field and throws `DOMException` with code `INVALID_STATE_ERR` on invalid values.
132800
+ *
132801
+ * @class
132802
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentType MDN
132803
+ */
132635
132804
  function DocumentType() {
132636
132805
  } DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
132637
132806
  _extends(DocumentType,Node);
@@ -132659,11 +132828,48 @@ function requireDom$1 () {
132659
132828
  ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
132660
132829
  _extends(ProcessingInstruction,Node);
132661
132830
  function XMLSerializer(){}
132662
- XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
132663
- return nodeSerializeToString.call(node,isHtml,nodeFilter);
132831
+ /**
132832
+ * Returns the result of serializing `node` to XML.
132833
+ *
132834
+ * When `options.requireWellFormed` is `true`, the serializer throws for content that would
132835
+ * produce ill-formed XML.
132836
+ *
132837
+ * __This implementation differs from the specification:__
132838
+ * - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
132839
+ * at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
132840
+ * default behaviour) unless `requireWellFormed` is `true`.
132841
+ * - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
132842
+ * is only thrown to prevent injection vectors, not for all the spec mandated checks.
132843
+ *
132844
+ * @param {Node} node
132845
+ * @param {boolean} [isHtml]
132846
+ * @param {function} [nodeFilter]
132847
+ * @param {Object} [options]
132848
+ * @param {boolean} [options.requireWellFormed=false]
132849
+ * When `true`, throws for content that would produce ill-formed XML.
132850
+ * @returns {string}
132851
+ * @throws {DOMException}
132852
+ * With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
132853
+ * - a CDATASection node's data contains `"]]>"`,
132854
+ * - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
132855
+ * - a ProcessingInstruction's data contains `"?>"`,
132856
+ * - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
132857
+ * production,
132858
+ * - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
132859
+ * production, or
132860
+ * - a DocumentType's `internalSubset` contains `"]>"`.
132861
+ * Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
132862
+ * writes succeed and are covered by the serializer-level checks above.
132863
+ * @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
132864
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serialization
132865
+ * @see https://github.com/w3c/DOM-Parsing/issues/84
132866
+ */
132867
+ XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter,options){
132868
+ return nodeSerializeToString.call(node,isHtml,nodeFilter,options);
132664
132869
  };
132665
132870
  Node.prototype.toString = nodeSerializeToString;
132666
- function nodeSerializeToString(isHtml,nodeFilter){
132871
+ function nodeSerializeToString(isHtml,nodeFilter,options){
132872
+ var requireWellFormed = !!options && !!options.requireWellFormed;
132667
132873
  var buf = [];
132668
132874
  var refNode = this.nodeType == 9 && this.documentElement || this;
132669
132875
  var prefix = refNode.prefix;
@@ -132680,7 +132886,7 @@ function requireDom$1 () {
132680
132886
  ];
132681
132887
  }
132682
132888
  }
132683
- serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
132889
+ serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces,requireWellFormed);
132684
132890
  //console.log('###',this.nodeType,uri,prefix,buf.join(''))
132685
132891
  return buf.join('');
132686
132892
  }
@@ -132729,271 +132935,323 @@ function requireDom$1 () {
132729
132935
  buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
132730
132936
  }
132731
132937
 
132732
- function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
132938
+ function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
132733
132939
  if (!visibleNamespaces) {
132734
132940
  visibleNamespaces = [];
132735
132941
  }
132736
-
132737
- if(nodeFilter){
132738
- node = nodeFilter(node);
132739
- if(node){
132740
- if(typeof node == 'string'){
132741
- buf.push(node);
132742
- return;
132743
- }
132744
- }else {
132745
- return;
132746
- }
132747
- //buf.sort.apply(attrs, attributeSorter);
132748
- }
132749
-
132750
- switch(node.nodeType){
132751
- case ELEMENT_NODE:
132752
- var attrs = node.attributes;
132753
- var len = attrs.length;
132754
- var child = node.firstChild;
132755
- var nodeName = node.tagName;
132756
-
132757
- isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
132758
-
132759
- var prefixedNodeName = nodeName;
132760
- if (!isHTML && !node.prefix && node.namespaceURI) {
132761
- var defaultNS;
132762
- // lookup current default ns from `xmlns` attribute
132763
- for (var ai = 0; ai < attrs.length; ai++) {
132764
- if (attrs.item(ai).name === 'xmlns') {
132765
- defaultNS = attrs.item(ai).value;
132766
- break
132767
- }
132768
- }
132769
- if (!defaultNS) {
132770
- // lookup current default ns in visibleNamespaces
132771
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
132772
- var namespace = visibleNamespaces[nsi];
132773
- if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
132774
- defaultNS = namespace.namespace;
132775
- break
132942
+ walkDOM(node, { ns: visibleNamespaces, isHTML: isHTML }, {
132943
+ enter: function (n, ctx) {
132944
+ var ns = ctx.ns;
132945
+ var html = ctx.isHTML;
132946
+
132947
+ if (nodeFilter) {
132948
+ n = nodeFilter(n);
132949
+ if (n) {
132950
+ if (typeof n == 'string') {
132951
+ buf.push(n);
132952
+ return null;
132776
132953
  }
132954
+ } else {
132955
+ return null;
132777
132956
  }
132778
132957
  }
132779
- if (defaultNS !== node.namespaceURI) {
132780
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
132781
- var namespace = visibleNamespaces[nsi];
132782
- if (namespace.namespace === node.namespaceURI) {
132783
- if (namespace.prefix) {
132784
- prefixedNodeName = namespace.prefix + ':' + nodeName;
132958
+
132959
+ switch (n.nodeType) {
132960
+ case ELEMENT_NODE:
132961
+ var attrs = n.attributes;
132962
+ var len = attrs.length;
132963
+ var nodeName = n.tagName;
132964
+
132965
+ html = NAMESPACE.isHTML(n.namespaceURI) || html;
132966
+
132967
+ var prefixedNodeName = nodeName;
132968
+ if (!html && !n.prefix && n.namespaceURI) {
132969
+ var defaultNS;
132970
+ // lookup current default ns from `xmlns` attribute
132971
+ for (var ai = 0; ai < attrs.length; ai++) {
132972
+ if (attrs.item(ai).name === 'xmlns') {
132973
+ defaultNS = attrs.item(ai).value;
132974
+ break;
132975
+ }
132976
+ }
132977
+ if (!defaultNS) {
132978
+ // lookup current default ns in visibleNamespaces
132979
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
132980
+ var nsEntry = ns[nsi];
132981
+ if (nsEntry.prefix === '' && nsEntry.namespace === n.namespaceURI) {
132982
+ defaultNS = nsEntry.namespace;
132983
+ break;
132984
+ }
132985
+ }
132986
+ }
132987
+ if (defaultNS !== n.namespaceURI) {
132988
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
132989
+ var nsEntry = ns[nsi];
132990
+ if (nsEntry.namespace === n.namespaceURI) {
132991
+ if (nsEntry.prefix) {
132992
+ prefixedNodeName = nsEntry.prefix + ':' + nodeName;
132993
+ }
132994
+ break;
132995
+ }
132996
+ }
132785
132997
  }
132786
- break
132787
132998
  }
132788
- }
132789
- }
132790
- }
132791
132999
 
132792
- buf.push('<', prefixedNodeName);
133000
+ buf.push('<', prefixedNodeName);
133001
+
133002
+ // Build a fresh namespace snapshot for this element's children.
133003
+ // The slice prevents sibling elements from inheriting each other's declarations.
133004
+ var childNs = ns.slice();
133005
+ for (var i = 0; i < len; i++) {
133006
+ var attr = attrs.item(i);
133007
+ if (attr.prefix == 'xmlns') {
133008
+ childNs.push({ prefix: attr.localName, namespace: attr.value });
133009
+ } else if (attr.nodeName == 'xmlns') {
133010
+ childNs.push({ prefix: '', namespace: attr.value });
133011
+ }
133012
+ }
132793
133013
 
132794
- for(var i=0;i<len;i++){
132795
- // add namespaces for attributes
132796
- var attr = attrs.item(i);
132797
- if (attr.prefix == 'xmlns') {
132798
- visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
132799
- }else if(attr.nodeName == 'xmlns'){
132800
- visibleNamespaces.push({ prefix: '', namespace: attr.value });
132801
- }
132802
- }
133014
+ for (var i = 0; i < len; i++) {
133015
+ var attr = attrs.item(i);
133016
+ if (needNamespaceDefine(attr, html, childNs)) {
133017
+ var attrPrefix = attr.prefix || '';
133018
+ var uri = attr.namespaceURI;
133019
+ addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri);
133020
+ childNs.push({ prefix: attrPrefix, namespace: uri });
133021
+ }
133022
+ // Apply nodeFilter and serialize the attribute.
133023
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
133024
+ if (filteredAttr) {
133025
+ if (typeof filteredAttr === 'string') {
133026
+ buf.push(filteredAttr);
133027
+ } else {
133028
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
133029
+ }
133030
+ }
133031
+ }
132803
133032
 
132804
- for(var i=0;i<len;i++){
132805
- var attr = attrs.item(i);
132806
- if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
132807
- var prefix = attr.prefix||'';
132808
- var uri = attr.namespaceURI;
132809
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
132810
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
132811
- }
132812
- serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
132813
- }
133033
+ // add namespace for current node
133034
+ if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
133035
+ var nodePrefix = n.prefix || '';
133036
+ var uri = n.namespaceURI;
133037
+ addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri);
133038
+ childNs.push({ prefix: nodePrefix, namespace: uri });
133039
+ }
132814
133040
 
132815
- // add namespace for current node
132816
- if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
132817
- var prefix = node.prefix||'';
132818
- var uri = node.namespaceURI;
132819
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
132820
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
132821
- }
133041
+ var child = n.firstChild;
133042
+ if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
133043
+ buf.push('>');
133044
+ if (html && /^script$/i.test(nodeName)) {
133045
+ // Inline serialization for <script> children; return null to skip walkDOM descent.
133046
+ while (child) {
133047
+ if (child.data) {
133048
+ buf.push(child.data);
133049
+ } else {
133050
+ serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
133051
+ }
133052
+ child = child.nextSibling;
133053
+ }
133054
+ buf.push('</', nodeName, '>');
133055
+ return null;
133056
+ }
133057
+ // Return child context; walkDOM descends and exit emits the closing tag.
133058
+ return { ns: childNs, isHTML: html, tag: prefixedNodeName };
133059
+ } else {
133060
+ buf.push('/>');
133061
+ return null;
133062
+ }
132822
133063
 
132823
- if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
132824
- buf.push('>');
132825
- //if is cdata child node
132826
- if(isHTML && /^script$/i.test(nodeName)){
132827
- while(child){
132828
- if(child.data){
132829
- buf.push(child.data);
132830
- }else {
132831
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
133064
+ case DOCUMENT_NODE:
133065
+ case DOCUMENT_FRAGMENT_NODE:
133066
+ // Descend into children; exit is a no-op (tag is null).
133067
+ return { ns: ns.slice(), isHTML: html, tag: null };
133068
+
133069
+ case ATTRIBUTE_NODE:
133070
+ addSerializedAttribute(buf, n.name, n.value);
133071
+ return null;
133072
+
133073
+ case TEXT_NODE:
133074
+ /**
133075
+ * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
133076
+ * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
133077
+ * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
133078
+ * `&amp;` and `&lt;` respectively.
133079
+ * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
133080
+ * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
133081
+ * when that string is not marking the end of a CDATA section.
133082
+ *
133083
+ * In the content of elements, character data is any string of characters
133084
+ * which does not contain the start-delimiter of any markup
133085
+ * and does not include the CDATA-section-close delimiter, `]]>`.
133086
+ *
133087
+ * @see https://www.w3.org/TR/xml/#NT-CharData
133088
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
133089
+ */
133090
+ buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
133091
+ return null;
133092
+
133093
+ case CDATA_SECTION_NODE:
133094
+ if (requireWellFormed && n.data.indexOf(']]>') !== -1) {
133095
+ throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
132832
133096
  }
132833
- child = child.nextSibling;
132834
- }
132835
- }else
132836
- {
132837
- while(child){
132838
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
132839
- child = child.nextSibling;
132840
- }
132841
- }
132842
- buf.push('</',prefixedNodeName,'>');
132843
- }else {
132844
- buf.push('/>');
132845
- }
132846
- // remove added visible namespaces
132847
- //visibleNamespaces.length = startVisibleNamespaces;
132848
- return;
132849
- case DOCUMENT_NODE:
132850
- case DOCUMENT_FRAGMENT_NODE:
132851
- var child = node.firstChild;
132852
- while(child){
132853
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
132854
- child = child.nextSibling;
132855
- }
132856
- return;
132857
- case ATTRIBUTE_NODE:
132858
- return addSerializedAttribute(buf, node.name, node.value);
132859
- case TEXT_NODE:
132860
- /**
132861
- * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
132862
- * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
132863
- * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
132864
- * `&amp;` and `&lt;` respectively.
132865
- * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
132866
- * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
132867
- * when that string is not marking the end of a CDATA section.
132868
- *
132869
- * In the content of elements, character data is any string of characters
132870
- * which does not contain the start-delimiter of any markup
132871
- * and does not include the CDATA-section-close delimiter, `]]>`.
132872
- *
132873
- * @see https://www.w3.org/TR/xml/#NT-CharData
132874
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
132875
- */
132876
- return buf.push(node.data
132877
- .replace(/[<&>]/g,_xmlEncoder)
132878
- );
132879
- case CDATA_SECTION_NODE:
132880
- return buf.push( '<![CDATA[',node.data,']]>');
132881
- case COMMENT_NODE:
132882
- return buf.push( "<!--",node.data,"-->");
132883
- case DOCUMENT_TYPE_NODE:
132884
- var pubid = node.publicId;
132885
- var sysid = node.systemId;
132886
- buf.push('<!DOCTYPE ',node.name);
132887
- if(pubid){
132888
- buf.push(' PUBLIC ', pubid);
132889
- if (sysid && sysid!='.') {
132890
- buf.push(' ', sysid);
133097
+ buf.push('<![CDATA[', n.data.replace(/]]>/g, ']]]]><![CDATA[>'), ']]>');
133098
+ return null;
133099
+
133100
+ case COMMENT_NODE:
133101
+ if (requireWellFormed && n.data.indexOf('-->') !== -1) {
133102
+ throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
133103
+ }
133104
+ buf.push('<!--', n.data, '-->');
133105
+ return null;
133106
+
133107
+ case DOCUMENT_TYPE_NODE:
133108
+ if (requireWellFormed) {
133109
+ if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
133110
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
133111
+ }
133112
+ if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
133113
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType systemId is not a valid SystemLiteral');
133114
+ }
133115
+ if (n.internalSubset && n.internalSubset.indexOf(']>') !== -1) {
133116
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
133117
+ }
133118
+ }
133119
+ var pubid = n.publicId;
133120
+ var sysid = n.systemId;
133121
+ buf.push('<!DOCTYPE ', n.name);
133122
+ if (pubid) {
133123
+ buf.push(' PUBLIC ', pubid);
133124
+ if (sysid && sysid != '.') {
133125
+ buf.push(' ', sysid);
133126
+ }
133127
+ buf.push('>');
133128
+ } else if (sysid && sysid != '.') {
133129
+ buf.push(' SYSTEM ', sysid, '>');
133130
+ } else {
133131
+ var sub = n.internalSubset;
133132
+ if (sub) {
133133
+ buf.push(' [', sub, ']');
133134
+ }
133135
+ buf.push('>');
133136
+ }
133137
+ return null;
133138
+
133139
+ case PROCESSING_INSTRUCTION_NODE:
133140
+ if (requireWellFormed && n.data.indexOf('?>') !== -1) {
133141
+ throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
133142
+ }
133143
+ buf.push('<?', n.target, ' ', n.data, '?>');
133144
+ return null;
133145
+
133146
+ case ENTITY_REFERENCE_NODE:
133147
+ buf.push('&', n.nodeName, ';');
133148
+ return null;
133149
+
133150
+ //case ENTITY_NODE:
133151
+ //case NOTATION_NODE:
133152
+ default:
133153
+ buf.push('??', n.nodeName);
133154
+ return null;
132891
133155
  }
132892
- buf.push('>');
132893
- }else if(sysid && sysid!='.'){
132894
- buf.push(' SYSTEM ', sysid, '>');
132895
- }else {
132896
- var sub = node.internalSubset;
132897
- if(sub){
132898
- buf.push(" [",sub,"]");
133156
+ },
133157
+ exit: function (n, childCtx) {
133158
+ if (childCtx && childCtx.tag) {
133159
+ buf.push('</', childCtx.tag, '>');
132899
133160
  }
132900
- buf.push(">");
132901
- }
132902
- return;
132903
- case PROCESSING_INSTRUCTION_NODE:
132904
- return buf.push( "<?",node.target," ",node.data,"?>");
132905
- case ENTITY_REFERENCE_NODE:
132906
- return buf.push( '&',node.nodeName,';');
132907
- //case ENTITY_NODE:
132908
- //case NOTATION_NODE:
132909
- default:
132910
- buf.push('??',node.nodeName);
132911
- }
133161
+ },
133162
+ });
132912
133163
  }
132913
- function importNode(doc,node,deep){
132914
- var node2;
132915
- switch (node.nodeType) {
132916
- case ELEMENT_NODE:
132917
- node2 = node.cloneNode(false);
132918
- node2.ownerDocument = doc;
132919
- //var attrs = node2.attributes;
132920
- //var len = attrs.length;
132921
- //for(var i=0;i<len;i++){
132922
- //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
132923
- //}
132924
- case DOCUMENT_FRAGMENT_NODE:
132925
- break;
132926
- case ATTRIBUTE_NODE:
132927
- deep = true;
132928
- break;
132929
- //case ENTITY_REFERENCE_NODE:
132930
- //case PROCESSING_INSTRUCTION_NODE:
132931
- ////case TEXT_NODE:
132932
- //case CDATA_SECTION_NODE:
132933
- //case COMMENT_NODE:
132934
- // deep = false;
132935
- // break;
132936
- //case DOCUMENT_NODE:
132937
- //case DOCUMENT_TYPE_NODE:
132938
- //cannot be imported.
132939
- //case ENTITY_NODE:
132940
- //case NOTATION_NODE:
132941
- //can not hit in level3
132942
- //default:throw e;
132943
- }
132944
- if(!node2){
132945
- node2 = node.cloneNode(false);//false
132946
- }
132947
- node2.ownerDocument = doc;
132948
- node2.parentNode = null;
132949
- if(deep){
132950
- var child = node.firstChild;
132951
- while(child){
132952
- node2.appendChild(importNode(doc,child,deep));
132953
- child = child.nextSibling;
132954
- }
132955
- }
132956
- return node2;
133164
+ /**
133165
+ * Imports a node from a different document into `doc`, creating a new copy.
133166
+ * Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
133167
+ * stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
133168
+ * Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
133169
+ * always forced to `true`
133170
+ * because an attribute's value lives in a child text node.
133171
+ *
133172
+ * @param {Document} doc
133173
+ * The document that will own the imported node.
133174
+ * @param {Node} node
133175
+ * The node to import.
133176
+ * @param {boolean} deep
133177
+ * If `true`, descendants are imported recursively.
133178
+ * @returns {Node}
133179
+ * The newly imported node, now owned by `doc`.
133180
+ */
133181
+ function importNode(doc, node, deep) {
133182
+ var destRoot;
133183
+ walkDOM(node, null, {
133184
+ enter: function (srcNode, destParent) {
133185
+ // Shallow-clone the node and stamp it into the target document.
133186
+ var destNode = srcNode.cloneNode(false);
133187
+ destNode.ownerDocument = doc;
133188
+ destNode.parentNode = null;
133189
+ // capture as the root of the imported subtree or attach to parent.
133190
+ if (destParent === null) {
133191
+ destRoot = destNode;
133192
+ } else {
133193
+ destParent.appendChild(destNode);
133194
+ }
133195
+ // ATTRIBUTE_NODE must always be imported deeply: its value lives in a child text node.
133196
+ var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
133197
+ return shouldDeep ? destNode : null;
133198
+ },
133199
+ });
133200
+ return destRoot;
132957
133201
  }
132958
133202
  //
132959
133203
  //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
132960
133204
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
132961
- function cloneNode(doc,node,deep){
132962
- var node2 = new node.constructor();
132963
- for (var n in node) {
132964
- if (Object.prototype.hasOwnProperty.call(node, n)) {
132965
- var v = node[n];
132966
- if (typeof v != "object") {
132967
- if (v != node2[n]) {
132968
- node2[n] = v;
133205
+ function cloneNode(doc, node, deep) {
133206
+ var destRoot;
133207
+ walkDOM(node, null, {
133208
+ enter: function (srcNode, destParent) {
133209
+ // 1. Create a blank node of the same type and copy all scalar own properties.
133210
+ var destNode = new srcNode.constructor();
133211
+ for (var n in srcNode) {
133212
+ if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
133213
+ var v = srcNode[n];
133214
+ if (typeof v != 'object') {
133215
+ if (v != destNode[n]) {
133216
+ destNode[n] = v;
133217
+ }
133218
+ }
132969
133219
  }
132970
133220
  }
132971
- }
132972
- }
132973
- if(node.childNodes){
132974
- node2.childNodes = new NodeList();
132975
- }
132976
- node2.ownerDocument = doc;
132977
- switch (node2.nodeType) {
132978
- case ELEMENT_NODE:
132979
- var attrs = node.attributes;
132980
- var attrs2 = node2.attributes = new NamedNodeMap();
132981
- var len = attrs.length;
132982
- attrs2._ownerElement = node2;
132983
- for(var i=0;i<len;i++){
132984
- node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
132985
- }
132986
- break; case ATTRIBUTE_NODE:
132987
- deep = true;
132988
- }
132989
- if(deep){
132990
- var child = node.firstChild;
132991
- while(child){
132992
- node2.appendChild(cloneNode(doc,child,deep));
132993
- child = child.nextSibling;
132994
- }
132995
- }
132996
- return node2;
133221
+ if (srcNode.childNodes) {
133222
+ destNode.childNodes = new NodeList();
133223
+ }
133224
+ destNode.ownerDocument = doc;
133225
+ // 2. Handle node-type-specific setup.
133226
+ // Attributes are not DOM children, so they are cloned inline here
133227
+ // rather than by walkDOM descent.
133228
+ // ATTRIBUTE_NODE forces deep=true so its own children are walked.
133229
+ var shouldDeep = deep;
133230
+ switch (destNode.nodeType) {
133231
+ case ELEMENT_NODE:
133232
+ var attrs = srcNode.attributes;
133233
+ var attrs2 = (destNode.attributes = new NamedNodeMap());
133234
+ var len = attrs.length;
133235
+ attrs2._ownerElement = destNode;
133236
+ for (var i = 0; i < len; i++) {
133237
+ destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
133238
+ }
133239
+ break;
133240
+ case ATTRIBUTE_NODE:
133241
+ shouldDeep = true;
133242
+ }
133243
+ // 3. Attach to parent, or capture as the root of the cloned subtree.
133244
+ if (destParent !== null) {
133245
+ destParent.appendChild(destNode);
133246
+ } else {
133247
+ destRoot = destNode;
133248
+ }
133249
+ // 4. Return destNode as the context for children (causes walkDOM to descend),
133250
+ // or null to skip children (shallow clone).
133251
+ return shouldDeep ? destNode : null;
133252
+ },
133253
+ });
133254
+ return destRoot;
132997
133255
  }
132998
133256
 
132999
133257
  function __set__(object,key,value){
@@ -133009,49 +133267,55 @@ function requireDom$1 () {
133009
133267
  }
133010
133268
  });
133011
133269
 
133012
- Object.defineProperty(Node.prototype,'textContent',{
133013
- get:function(){
133014
- return getTextContent(this);
133270
+ /**
133271
+ * The text content of this node and its descendants.
133272
+ *
133273
+ * Setting `textContent` on an element or document fragment replaces all child nodes with a
133274
+ * single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
133275
+ *
133276
+ * @type {string | null}
133277
+ * @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
133278
+ */
133279
+ Object.defineProperty(Node.prototype, 'textContent', {
133280
+ get: function () {
133281
+ if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
133282
+ var buf = [];
133283
+ walkDOM(this, null, {
133284
+ enter: function (n) {
133285
+ if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
133286
+ return true; // enter children
133287
+ }
133288
+ if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
133289
+ return null; // excluded from text content
133290
+ }
133291
+ buf.push(n.nodeValue);
133292
+ },
133293
+ });
133294
+ return buf.join('');
133295
+ }
133296
+ return this.nodeValue;
133015
133297
  },
133016
133298
 
133017
- set:function(data){
133018
- switch(this.nodeType){
133019
- case ELEMENT_NODE:
133020
- case DOCUMENT_FRAGMENT_NODE:
133021
- while(this.firstChild){
133022
- this.removeChild(this.firstChild);
133023
- }
133024
- if(data || String(data)){
133025
- this.appendChild(this.ownerDocument.createTextNode(data));
133026
- }
133027
- break;
133299
+ set: function (data) {
133300
+ switch (this.nodeType) {
133301
+ case ELEMENT_NODE:
133302
+ case DOCUMENT_FRAGMENT_NODE:
133303
+ while (this.firstChild) {
133304
+ this.removeChild(this.firstChild);
133305
+ }
133306
+ if (data || String(data)) {
133307
+ this.appendChild(this.ownerDocument.createTextNode(data));
133308
+ }
133309
+ break;
133028
133310
 
133029
- default:
133030
- this.data = data;
133031
- this.value = data;
133032
- this.nodeValue = data;
133311
+ default:
133312
+ this.data = data;
133313
+ this.value = data;
133314
+ this.nodeValue = data;
133033
133315
  }
133034
- }
133316
+ },
133035
133317
  });
133036
133318
 
133037
- function getTextContent(node){
133038
- switch(node.nodeType){
133039
- case ELEMENT_NODE:
133040
- case DOCUMENT_FRAGMENT_NODE:
133041
- var buf = [];
133042
- node = node.firstChild;
133043
- while(node){
133044
- if(node.nodeType!==7 && node.nodeType !==8){
133045
- buf.push(getTextContent(node));
133046
- }
133047
- node = node.nextSibling;
133048
- }
133049
- return buf.join('');
133050
- default:
133051
- return node.nodeValue;
133052
- }
133053
- }
133054
-
133055
133319
  __set__ = function(object,key,value){
133056
133320
  //console.log(value)
133057
133321
  object['$$'+key] = value;
@@ -133067,6 +133331,7 @@ function requireDom$1 () {
133067
133331
  dom$1.Element = Element;
133068
133332
  dom$1.Node = Node;
133069
133333
  dom$1.NodeList = NodeList;
133334
+ dom$1.walkDOM = walkDOM;
133070
133335
  dom$1.XMLSerializer = XMLSerializer;
133071
133336
  //}
133072
133337
  return dom$1;
@@ -135857,7 +136122,7 @@ function requireSax$1 () {
135857
136122
  function parseInstruction(source,start,domBuilder){
135858
136123
  var end = source.indexOf('?>',start);
135859
136124
  if(end){
135860
- var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
136125
+ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
135861
136126
  if(match){
135862
136127
  match[0].length;
135863
136128
  domBuilder.processingInstruction(match[1], match[2]) ;
@@ -142744,7 +143009,7 @@ function requireMomentTimezone$1 () {
142744
143009
  hasRequiredMomentTimezone$1 = 1;
142745
143010
  (function (module) {
142746
143011
  //! moment-timezone.js
142747
- //! version : 0.6.0
143012
+ //! version : 0.6.1
142748
143013
  //! Copyright (c) JS Foundation and other contributors
142749
143014
  //! license : MIT
142750
143015
  //! github.com/moment/moment-timezone
@@ -142770,7 +143035,7 @@ function requireMomentTimezone$1 () {
142770
143035
  // return moment;
142771
143036
  // }
142772
143037
 
142773
- var VERSION = "0.6.0",
143038
+ var VERSION = "0.6.1",
142774
143039
  zones = {},
142775
143040
  links = {},
142776
143041
  countries = {},
@@ -188045,14 +188310,14 @@ function requireDom () {
188045
188310
  ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
188046
188311
  var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
188047
188312
  ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
188048
- ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
188313
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
188049
188314
  ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
188050
188315
  ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
188051
188316
  var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
188052
188317
  ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
188053
188318
  var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
188054
188319
  //level2
188055
- ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
188320
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
188056
188321
  ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
188057
188322
  ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
188058
188323
  ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
@@ -188102,9 +188367,10 @@ function requireDom () {
188102
188367
  item: function(index) {
188103
188368
  return index >= 0 && index < this.length ? this[index] : null;
188104
188369
  },
188105
- toString:function(isHTML,nodeFilter){
188370
+ toString:function(isHTML,nodeFilter,options){
188371
+ var requireWellFormed = !!options && !!options.requireWellFormed;
188106
188372
  for(var buf = [], i = 0;i<this.length;i++){
188107
- serializeToString(this[i],buf,isHTML,nodeFilter);
188373
+ serializeToString(this[i],buf,isHTML,nodeFilter,null,requireWellFormed);
188108
188374
  }
188109
188375
  return buf.join('');
188110
188376
  },
@@ -188349,13 +188615,28 @@ function requireDom () {
188349
188615
  /**
188350
188616
  * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
188351
188617
  *
188352
- * __This behavior is slightly different from the in the specs__:
188618
+ * __This implementation differs from the specification:__
188353
188619
  * - this implementation is not validating names or qualified names
188354
188620
  * (when parsing XML strings, the SAX parser takes care of that)
188355
188621
  *
188622
+ * Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
188623
+ * Creation-time validation of `publicId`, `systemId` is not enforced.
188624
+ * The serializer-level check covers all mutation vectors, including direct property writes.
188625
+ * `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
188626
+ * absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
188627
+ * silently omitted from the serialized output.
188628
+ *
188356
188629
  * @param {string} qualifiedName
188357
188630
  * @param {string} [publicId]
188631
+ * The external subset public identifier. Stored verbatim including surrounding quotes.
188632
+ * When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
188633
+ * throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
188634
+ * not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
188358
188635
  * @param {string} [systemId]
188636
+ * The external subset system identifier. Stored verbatim including surrounding quotes.
188637
+ * When serialized with `requireWellFormed: true`, throws `DOMException` with code
188638
+ * `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
188639
+ * production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
188359
188640
  * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
188360
188641
  * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
188361
188642
  *
@@ -188421,18 +188702,44 @@ function requireDom () {
188421
188702
  return cloneNode(this.ownerDocument||this,this,deep);
188422
188703
  },
188423
188704
  // Modified in DOM Level 2:
188424
- normalize:function(){
188425
- var child = this.firstChild;
188426
- while(child){
188427
- var next = child.nextSibling;
188428
- if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
188429
- this.removeChild(next);
188430
- child.appendData(next.data);
188431
- }else {
188432
- child.normalize();
188433
- child = next;
188434
- }
188435
- }
188705
+ /**
188706
+ * Puts the specified node and all of its subtree into a "normalized" form. In a normalized
188707
+ * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
188708
+ *
188709
+ * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
188710
+ * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
188711
+ * nodes.
188712
+ *
188713
+ * This method iteratively traverses all child nodes to normalize all descendant nodes within
188714
+ * the subtree.
188715
+ *
188716
+ * @throws {DOMException}
188717
+ * May throw a DOMException if operations within removeChild or appendData (which are
188718
+ * potentially invoked in this method) do not meet their specific constraints.
188719
+ * @see {@link Node.removeChild}
188720
+ * @see {@link CharacterData.appendData}
188721
+ * @see ../docs/walk-dom.md.
188722
+ */
188723
+ normalize: function () {
188724
+ walkDOM(this, null, {
188725
+ enter: function (node) {
188726
+ // Merge adjacent text children of node before walkDOM schedules them.
188727
+ // walkDOM reads lastChild/previousSibling after enter returns, so the
188728
+ // surviving post-merge children are what it descends into.
188729
+ var child = node.firstChild;
188730
+ while (child) {
188731
+ var next = child.nextSibling;
188732
+ if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
188733
+ node.removeChild(next);
188734
+ child.appendData(next.data);
188735
+ // Do not advance child: re-check new nextSibling for another text run
188736
+ } else {
188737
+ child = next;
188738
+ }
188739
+ }
188740
+ return true; // descend into surviving children
188741
+ },
188742
+ });
188436
188743
  },
188437
188744
  // Introduced in DOM Level 2:
188438
188745
  isSupported:function(feature, version){
@@ -188508,21 +188815,103 @@ function requireDom () {
188508
188815
  copy(NodeType,Node.prototype);
188509
188816
 
188510
188817
  /**
188511
- * @param callback return true for continue,false for break
188512
- * @return boolean true: break visit;
188818
+ * @param {Node} node
188819
+ * Root of the subtree to visit.
188820
+ * @param {function(Node): boolean} callback
188821
+ * Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
188822
+ * @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
188513
188823
  */
188514
- function _visitNode(node,callback){
188515
- if(callback(node)){
188516
- return true;
188517
- }
188518
- if(node = node.firstChild){
188519
- do{
188520
- if(_visitNode(node,callback)){return true}
188521
- }while(node=node.nextSibling)
188522
- }
188824
+ function _visitNode(node, callback) {
188825
+ return walkDOM(node, null, { enter: function (n) { return callback(n) ? walkDOM.STOP : true; } }) === walkDOM.STOP;
188523
188826
  }
188524
188827
 
188828
+ /**
188829
+ * Depth-first pre/post-order DOM tree walker.
188830
+ *
188831
+ * Visits every node in the subtree rooted at `node`. For each node:
188832
+ *
188833
+ * 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
188834
+ * return value becomes the `context` passed to each child's `enter` call and to the matching
188835
+ * `exit` call.
188836
+ * 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
188837
+ * sibling traversal continues normally.
188838
+ * 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
188839
+ * further `enter` or `exit` calls are made.
188840
+ * 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
188841
+ * safely modify the node's own child list before the walker descends. Modifying siblings of
188842
+ * the current node or any other part of the tree produces unpredictable results: nodes already
188843
+ * queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
188844
+ * the current child list are never visited.
188845
+ * 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
188846
+ * been visited, passing the same `context` that `enter`
188847
+ * returned for that node.
188848
+ *
188849
+ * This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
188850
+ * deep trees.
188851
+ *
188852
+ * @param {Node} node
188853
+ * Root of the subtree to walk.
188854
+ * @param {*} context
188855
+ * Initial context value passed to the root node's `enter`.
188856
+ * @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
188857
+ * @returns {void | walkDOM.STOP}
188858
+ * @see ../docs/walk-dom.md.
188859
+ */
188860
+ function walkDOM(node, context, callbacks) {
188861
+ // Each stack frame is {node, context, phase}:
188862
+ // walkDOM.ENTER — call enter, then push children
188863
+ // walkDOM.EXIT — call exit
188864
+ var stack = [{ node: node, context: context, phase: walkDOM.ENTER }];
188865
+ while (stack.length > 0) {
188866
+ var frame = stack.pop();
188867
+ if (frame.phase === walkDOM.ENTER) {
188868
+ var childContext = callbacks.enter(frame.node, frame.context);
188869
+ if (childContext === walkDOM.STOP) {
188870
+ return walkDOM.STOP;
188871
+ }
188872
+ // Push exit frame before children so it fires after all children are processed (Last In First Out)
188873
+ stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
188874
+ if (childContext === null || childContext === undefined) {
188875
+ continue; // skip children
188876
+ }
188877
+ // lastChild is read after enter returns, so enter may modify the child list.
188878
+ var child = frame.node.lastChild;
188879
+ // Traverse from lastChild backwards so that pushing onto the stack
188880
+ // naturally yields firstChild on top (processed first).
188881
+ while (child) {
188882
+ stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
188883
+ child = child.previousSibling;
188884
+ }
188885
+ } else {
188886
+ // frame.phase === walkDOM.EXIT
188887
+ if (callbacks.exit) {
188888
+ callbacks.exit(frame.node, frame.context);
188889
+ }
188890
+ }
188891
+ }
188892
+ }
188525
188893
 
188894
+ /**
188895
+ * Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
188896
+ * immediately.
188897
+ *
188898
+ * @type {symbol}
188899
+ */
188900
+ walkDOM.STOP = Symbol('walkDOM.STOP');
188901
+ /**
188902
+ * Phase constant for a stack frame that has not yet been visited.
188903
+ * The `enter` callback is called and children are scheduled.
188904
+ *
188905
+ * @type {number}
188906
+ */
188907
+ walkDOM.ENTER = 0;
188908
+ /**
188909
+ * Phase constant for a stack frame whose subtree has been fully visited.
188910
+ * The `exit` callback is called.
188911
+ *
188912
+ * @type {number}
188913
+ */
188914
+ walkDOM.EXIT = 1;
188526
188915
 
188527
188916
  function Document(){
188528
188917
  this.ownerDocument = this;
@@ -189126,12 +189515,44 @@ function requireDom () {
189126
189515
  node.appendData(data);
189127
189516
  return node;
189128
189517
  },
189518
+ /**
189519
+ * Returns a new CDATASection node whose data is `data`.
189520
+ *
189521
+ * __This implementation differs from the specification:__
189522
+ * - calling this method on an HTML document does not throw `NotSupportedError`.
189523
+ *
189524
+ * @param {string} data
189525
+ * @returns {CDATASection}
189526
+ * @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
189527
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
189528
+ * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
189529
+ */
189129
189530
  createCDATASection : function(data){
189531
+ if (data.indexOf(']]>') !== -1) {
189532
+ throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
189533
+ }
189130
189534
  var node = new CDATASection();
189131
189535
  node.ownerDocument = this;
189132
189536
  node.appendData(data);
189133
189537
  return node;
189134
189538
  },
189539
+ /**
189540
+ * Returns a ProcessingInstruction node whose target is target and data is data.
189541
+ *
189542
+ * __This implementation differs from the specification:__
189543
+ * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
189544
+ *
189545
+ * Note: When the resulting document is serialized with `requireWellFormed: true`, the
189546
+ * serializer throws with code `INVALID_STATE_ERR` if `.data` contains `?>` (W3C DOM Parsing
189547
+ * §3.2.1.7). Without that option the data is emitted verbatim.
189548
+ *
189549
+ * @param {string} target
189550
+ * @param {string} data
189551
+ * @returns {ProcessingInstruction}
189552
+ * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
189553
+ * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
189554
+ * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
189555
+ */
189135
189556
  createProcessingInstruction : function(target,data){
189136
189557
  var node = new ProcessingInstruction();
189137
189558
  node.ownerDocument = this;
@@ -189357,6 +189778,19 @@ function requireDom () {
189357
189778
  _extends(CDATASection,CharacterData);
189358
189779
 
189359
189780
 
189781
+ /**
189782
+ * Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
189783
+ *
189784
+ * `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
189785
+ * xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
189786
+ * direct property writes succeed silently. Values are serialized verbatim when
189787
+ * `requireWellFormed` is false (the default). When the serializer is invoked with
189788
+ * `requireWellFormed: true` (via the 4th-parameter options object), it validates each
189789
+ * field and throws `DOMException` with code `INVALID_STATE_ERR` on invalid values.
189790
+ *
189791
+ * @class
189792
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentType MDN
189793
+ */
189360
189794
  function DocumentType() {
189361
189795
  } DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
189362
189796
  _extends(DocumentType,Node);
@@ -189384,11 +189818,48 @@ function requireDom () {
189384
189818
  ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
189385
189819
  _extends(ProcessingInstruction,Node);
189386
189820
  function XMLSerializer(){}
189387
- XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
189388
- return nodeSerializeToString.call(node,isHtml,nodeFilter);
189821
+ /**
189822
+ * Returns the result of serializing `node` to XML.
189823
+ *
189824
+ * When `options.requireWellFormed` is `true`, the serializer throws for content that would
189825
+ * produce ill-formed XML.
189826
+ *
189827
+ * __This implementation differs from the specification:__
189828
+ * - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
189829
+ * at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
189830
+ * default behaviour) unless `requireWellFormed` is `true`.
189831
+ * - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
189832
+ * is only thrown to prevent injection vectors, not for all the spec mandated checks.
189833
+ *
189834
+ * @param {Node} node
189835
+ * @param {boolean} [isHtml]
189836
+ * @param {function} [nodeFilter]
189837
+ * @param {Object} [options]
189838
+ * @param {boolean} [options.requireWellFormed=false]
189839
+ * When `true`, throws for content that would produce ill-formed XML.
189840
+ * @returns {string}
189841
+ * @throws {DOMException}
189842
+ * With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
189843
+ * - a CDATASection node's data contains `"]]>"`,
189844
+ * - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
189845
+ * - a ProcessingInstruction's data contains `"?>"`,
189846
+ * - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
189847
+ * production,
189848
+ * - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
189849
+ * production, or
189850
+ * - a DocumentType's `internalSubset` contains `"]>"`.
189851
+ * Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
189852
+ * writes succeed and are covered by the serializer-level checks above.
189853
+ * @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
189854
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serialization
189855
+ * @see https://github.com/w3c/DOM-Parsing/issues/84
189856
+ */
189857
+ XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter,options){
189858
+ return nodeSerializeToString.call(node,isHtml,nodeFilter,options);
189389
189859
  };
189390
189860
  Node.prototype.toString = nodeSerializeToString;
189391
- function nodeSerializeToString(isHtml,nodeFilter){
189861
+ function nodeSerializeToString(isHtml,nodeFilter,options){
189862
+ var requireWellFormed = !!options && !!options.requireWellFormed;
189392
189863
  var buf = [];
189393
189864
  var refNode = this.nodeType == 9 && this.documentElement || this;
189394
189865
  var prefix = refNode.prefix;
@@ -189405,7 +189876,7 @@ function requireDom () {
189405
189876
  ];
189406
189877
  }
189407
189878
  }
189408
- serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
189879
+ serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces,requireWellFormed);
189409
189880
  //console.log('###',this.nodeType,uri,prefix,buf.join(''))
189410
189881
  return buf.join('');
189411
189882
  }
@@ -189454,271 +189925,323 @@ function requireDom () {
189454
189925
  buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
189455
189926
  }
189456
189927
 
189457
- function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
189928
+ function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
189458
189929
  if (!visibleNamespaces) {
189459
189930
  visibleNamespaces = [];
189460
189931
  }
189461
-
189462
- if(nodeFilter){
189463
- node = nodeFilter(node);
189464
- if(node){
189465
- if(typeof node == 'string'){
189466
- buf.push(node);
189467
- return;
189468
- }
189469
- }else {
189470
- return;
189471
- }
189472
- //buf.sort.apply(attrs, attributeSorter);
189473
- }
189474
-
189475
- switch(node.nodeType){
189476
- case ELEMENT_NODE:
189477
- var attrs = node.attributes;
189478
- var len = attrs.length;
189479
- var child = node.firstChild;
189480
- var nodeName = node.tagName;
189481
-
189482
- isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
189483
-
189484
- var prefixedNodeName = nodeName;
189485
- if (!isHTML && !node.prefix && node.namespaceURI) {
189486
- var defaultNS;
189487
- // lookup current default ns from `xmlns` attribute
189488
- for (var ai = 0; ai < attrs.length; ai++) {
189489
- if (attrs.item(ai).name === 'xmlns') {
189490
- defaultNS = attrs.item(ai).value;
189491
- break
189492
- }
189493
- }
189494
- if (!defaultNS) {
189495
- // lookup current default ns in visibleNamespaces
189496
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
189497
- var namespace = visibleNamespaces[nsi];
189498
- if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
189499
- defaultNS = namespace.namespace;
189500
- break
189932
+ walkDOM(node, { ns: visibleNamespaces, isHTML: isHTML }, {
189933
+ enter: function (n, ctx) {
189934
+ var ns = ctx.ns;
189935
+ var html = ctx.isHTML;
189936
+
189937
+ if (nodeFilter) {
189938
+ n = nodeFilter(n);
189939
+ if (n) {
189940
+ if (typeof n == 'string') {
189941
+ buf.push(n);
189942
+ return null;
189501
189943
  }
189944
+ } else {
189945
+ return null;
189502
189946
  }
189503
189947
  }
189504
- if (defaultNS !== node.namespaceURI) {
189505
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
189506
- var namespace = visibleNamespaces[nsi];
189507
- if (namespace.namespace === node.namespaceURI) {
189508
- if (namespace.prefix) {
189509
- prefixedNodeName = namespace.prefix + ':' + nodeName;
189948
+
189949
+ switch (n.nodeType) {
189950
+ case ELEMENT_NODE:
189951
+ var attrs = n.attributes;
189952
+ var len = attrs.length;
189953
+ var nodeName = n.tagName;
189954
+
189955
+ html = NAMESPACE.isHTML(n.namespaceURI) || html;
189956
+
189957
+ var prefixedNodeName = nodeName;
189958
+ if (!html && !n.prefix && n.namespaceURI) {
189959
+ var defaultNS;
189960
+ // lookup current default ns from `xmlns` attribute
189961
+ for (var ai = 0; ai < attrs.length; ai++) {
189962
+ if (attrs.item(ai).name === 'xmlns') {
189963
+ defaultNS = attrs.item(ai).value;
189964
+ break;
189965
+ }
189966
+ }
189967
+ if (!defaultNS) {
189968
+ // lookup current default ns in visibleNamespaces
189969
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
189970
+ var nsEntry = ns[nsi];
189971
+ if (nsEntry.prefix === '' && nsEntry.namespace === n.namespaceURI) {
189972
+ defaultNS = nsEntry.namespace;
189973
+ break;
189974
+ }
189975
+ }
189976
+ }
189977
+ if (defaultNS !== n.namespaceURI) {
189978
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
189979
+ var nsEntry = ns[nsi];
189980
+ if (nsEntry.namespace === n.namespaceURI) {
189981
+ if (nsEntry.prefix) {
189982
+ prefixedNodeName = nsEntry.prefix + ':' + nodeName;
189983
+ }
189984
+ break;
189985
+ }
189986
+ }
189510
189987
  }
189511
- break
189512
189988
  }
189513
- }
189514
- }
189515
- }
189516
189989
 
189517
- buf.push('<', prefixedNodeName);
189990
+ buf.push('<', prefixedNodeName);
189991
+
189992
+ // Build a fresh namespace snapshot for this element's children.
189993
+ // The slice prevents sibling elements from inheriting each other's declarations.
189994
+ var childNs = ns.slice();
189995
+ for (var i = 0; i < len; i++) {
189996
+ var attr = attrs.item(i);
189997
+ if (attr.prefix == 'xmlns') {
189998
+ childNs.push({ prefix: attr.localName, namespace: attr.value });
189999
+ } else if (attr.nodeName == 'xmlns') {
190000
+ childNs.push({ prefix: '', namespace: attr.value });
190001
+ }
190002
+ }
189518
190003
 
189519
- for(var i=0;i<len;i++){
189520
- // add namespaces for attributes
189521
- var attr = attrs.item(i);
189522
- if (attr.prefix == 'xmlns') {
189523
- visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
189524
- }else if(attr.nodeName == 'xmlns'){
189525
- visibleNamespaces.push({ prefix: '', namespace: attr.value });
189526
- }
189527
- }
190004
+ for (var i = 0; i < len; i++) {
190005
+ var attr = attrs.item(i);
190006
+ if (needNamespaceDefine(attr, html, childNs)) {
190007
+ var attrPrefix = attr.prefix || '';
190008
+ var uri = attr.namespaceURI;
190009
+ addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri);
190010
+ childNs.push({ prefix: attrPrefix, namespace: uri });
190011
+ }
190012
+ // Apply nodeFilter and serialize the attribute.
190013
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
190014
+ if (filteredAttr) {
190015
+ if (typeof filteredAttr === 'string') {
190016
+ buf.push(filteredAttr);
190017
+ } else {
190018
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
190019
+ }
190020
+ }
190021
+ }
189528
190022
 
189529
- for(var i=0;i<len;i++){
189530
- var attr = attrs.item(i);
189531
- if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
189532
- var prefix = attr.prefix||'';
189533
- var uri = attr.namespaceURI;
189534
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
189535
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
189536
- }
189537
- serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
189538
- }
190023
+ // add namespace for current node
190024
+ if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
190025
+ var nodePrefix = n.prefix || '';
190026
+ var uri = n.namespaceURI;
190027
+ addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri);
190028
+ childNs.push({ prefix: nodePrefix, namespace: uri });
190029
+ }
189539
190030
 
189540
- // add namespace for current node
189541
- if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
189542
- var prefix = node.prefix||'';
189543
- var uri = node.namespaceURI;
189544
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
189545
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
189546
- }
190031
+ var child = n.firstChild;
190032
+ if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
190033
+ buf.push('>');
190034
+ if (html && /^script$/i.test(nodeName)) {
190035
+ // Inline serialization for <script> children; return null to skip walkDOM descent.
190036
+ while (child) {
190037
+ if (child.data) {
190038
+ buf.push(child.data);
190039
+ } else {
190040
+ serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
190041
+ }
190042
+ child = child.nextSibling;
190043
+ }
190044
+ buf.push('</', nodeName, '>');
190045
+ return null;
190046
+ }
190047
+ // Return child context; walkDOM descends and exit emits the closing tag.
190048
+ return { ns: childNs, isHTML: html, tag: prefixedNodeName };
190049
+ } else {
190050
+ buf.push('/>');
190051
+ return null;
190052
+ }
189547
190053
 
189548
- if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
189549
- buf.push('>');
189550
- //if is cdata child node
189551
- if(isHTML && /^script$/i.test(nodeName)){
189552
- while(child){
189553
- if(child.data){
189554
- buf.push(child.data);
189555
- }else {
189556
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
190054
+ case DOCUMENT_NODE:
190055
+ case DOCUMENT_FRAGMENT_NODE:
190056
+ // Descend into children; exit is a no-op (tag is null).
190057
+ return { ns: ns.slice(), isHTML: html, tag: null };
190058
+
190059
+ case ATTRIBUTE_NODE:
190060
+ addSerializedAttribute(buf, n.name, n.value);
190061
+ return null;
190062
+
190063
+ case TEXT_NODE:
190064
+ /**
190065
+ * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
190066
+ * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
190067
+ * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
190068
+ * `&amp;` and `&lt;` respectively.
190069
+ * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
190070
+ * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
190071
+ * when that string is not marking the end of a CDATA section.
190072
+ *
190073
+ * In the content of elements, character data is any string of characters
190074
+ * which does not contain the start-delimiter of any markup
190075
+ * and does not include the CDATA-section-close delimiter, `]]>`.
190076
+ *
190077
+ * @see https://www.w3.org/TR/xml/#NT-CharData
190078
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
190079
+ */
190080
+ buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
190081
+ return null;
190082
+
190083
+ case CDATA_SECTION_NODE:
190084
+ if (requireWellFormed && n.data.indexOf(']]>') !== -1) {
190085
+ throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
189557
190086
  }
189558
- child = child.nextSibling;
189559
- }
189560
- }else
189561
- {
189562
- while(child){
189563
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
189564
- child = child.nextSibling;
189565
- }
189566
- }
189567
- buf.push('</',prefixedNodeName,'>');
189568
- }else {
189569
- buf.push('/>');
189570
- }
189571
- // remove added visible namespaces
189572
- //visibleNamespaces.length = startVisibleNamespaces;
189573
- return;
189574
- case DOCUMENT_NODE:
189575
- case DOCUMENT_FRAGMENT_NODE:
189576
- var child = node.firstChild;
189577
- while(child){
189578
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
189579
- child = child.nextSibling;
189580
- }
189581
- return;
189582
- case ATTRIBUTE_NODE:
189583
- return addSerializedAttribute(buf, node.name, node.value);
189584
- case TEXT_NODE:
189585
- /**
189586
- * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
189587
- * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
189588
- * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
189589
- * `&amp;` and `&lt;` respectively.
189590
- * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
189591
- * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
189592
- * when that string is not marking the end of a CDATA section.
189593
- *
189594
- * In the content of elements, character data is any string of characters
189595
- * which does not contain the start-delimiter of any markup
189596
- * and does not include the CDATA-section-close delimiter, `]]>`.
189597
- *
189598
- * @see https://www.w3.org/TR/xml/#NT-CharData
189599
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
189600
- */
189601
- return buf.push(node.data
189602
- .replace(/[<&>]/g,_xmlEncoder)
189603
- );
189604
- case CDATA_SECTION_NODE:
189605
- return buf.push( '<![CDATA[',node.data,']]>');
189606
- case COMMENT_NODE:
189607
- return buf.push( "<!--",node.data,"-->");
189608
- case DOCUMENT_TYPE_NODE:
189609
- var pubid = node.publicId;
189610
- var sysid = node.systemId;
189611
- buf.push('<!DOCTYPE ',node.name);
189612
- if(pubid){
189613
- buf.push(' PUBLIC ', pubid);
189614
- if (sysid && sysid!='.') {
189615
- buf.push(' ', sysid);
190087
+ buf.push('<![CDATA[', n.data.replace(/]]>/g, ']]]]><![CDATA[>'), ']]>');
190088
+ return null;
190089
+
190090
+ case COMMENT_NODE:
190091
+ if (requireWellFormed && n.data.indexOf('-->') !== -1) {
190092
+ throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
190093
+ }
190094
+ buf.push('<!--', n.data, '-->');
190095
+ return null;
190096
+
190097
+ case DOCUMENT_TYPE_NODE:
190098
+ if (requireWellFormed) {
190099
+ if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
190100
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
190101
+ }
190102
+ if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
190103
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType systemId is not a valid SystemLiteral');
190104
+ }
190105
+ if (n.internalSubset && n.internalSubset.indexOf(']>') !== -1) {
190106
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
190107
+ }
190108
+ }
190109
+ var pubid = n.publicId;
190110
+ var sysid = n.systemId;
190111
+ buf.push('<!DOCTYPE ', n.name);
190112
+ if (pubid) {
190113
+ buf.push(' PUBLIC ', pubid);
190114
+ if (sysid && sysid != '.') {
190115
+ buf.push(' ', sysid);
190116
+ }
190117
+ buf.push('>');
190118
+ } else if (sysid && sysid != '.') {
190119
+ buf.push(' SYSTEM ', sysid, '>');
190120
+ } else {
190121
+ var sub = n.internalSubset;
190122
+ if (sub) {
190123
+ buf.push(' [', sub, ']');
190124
+ }
190125
+ buf.push('>');
190126
+ }
190127
+ return null;
190128
+
190129
+ case PROCESSING_INSTRUCTION_NODE:
190130
+ if (requireWellFormed && n.data.indexOf('?>') !== -1) {
190131
+ throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
190132
+ }
190133
+ buf.push('<?', n.target, ' ', n.data, '?>');
190134
+ return null;
190135
+
190136
+ case ENTITY_REFERENCE_NODE:
190137
+ buf.push('&', n.nodeName, ';');
190138
+ return null;
190139
+
190140
+ //case ENTITY_NODE:
190141
+ //case NOTATION_NODE:
190142
+ default:
190143
+ buf.push('??', n.nodeName);
190144
+ return null;
189616
190145
  }
189617
- buf.push('>');
189618
- }else if(sysid && sysid!='.'){
189619
- buf.push(' SYSTEM ', sysid, '>');
189620
- }else {
189621
- var sub = node.internalSubset;
189622
- if(sub){
189623
- buf.push(" [",sub,"]");
190146
+ },
190147
+ exit: function (n, childCtx) {
190148
+ if (childCtx && childCtx.tag) {
190149
+ buf.push('</', childCtx.tag, '>');
189624
190150
  }
189625
- buf.push(">");
189626
- }
189627
- return;
189628
- case PROCESSING_INSTRUCTION_NODE:
189629
- return buf.push( "<?",node.target," ",node.data,"?>");
189630
- case ENTITY_REFERENCE_NODE:
189631
- return buf.push( '&',node.nodeName,';');
189632
- //case ENTITY_NODE:
189633
- //case NOTATION_NODE:
189634
- default:
189635
- buf.push('??',node.nodeName);
189636
- }
190151
+ },
190152
+ });
189637
190153
  }
189638
- function importNode(doc,node,deep){
189639
- var node2;
189640
- switch (node.nodeType) {
189641
- case ELEMENT_NODE:
189642
- node2 = node.cloneNode(false);
189643
- node2.ownerDocument = doc;
189644
- //var attrs = node2.attributes;
189645
- //var len = attrs.length;
189646
- //for(var i=0;i<len;i++){
189647
- //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
189648
- //}
189649
- case DOCUMENT_FRAGMENT_NODE:
189650
- break;
189651
- case ATTRIBUTE_NODE:
189652
- deep = true;
189653
- break;
189654
- //case ENTITY_REFERENCE_NODE:
189655
- //case PROCESSING_INSTRUCTION_NODE:
189656
- ////case TEXT_NODE:
189657
- //case CDATA_SECTION_NODE:
189658
- //case COMMENT_NODE:
189659
- // deep = false;
189660
- // break;
189661
- //case DOCUMENT_NODE:
189662
- //case DOCUMENT_TYPE_NODE:
189663
- //cannot be imported.
189664
- //case ENTITY_NODE:
189665
- //case NOTATION_NODE:
189666
- //can not hit in level3
189667
- //default:throw e;
189668
- }
189669
- if(!node2){
189670
- node2 = node.cloneNode(false);//false
189671
- }
189672
- node2.ownerDocument = doc;
189673
- node2.parentNode = null;
189674
- if(deep){
189675
- var child = node.firstChild;
189676
- while(child){
189677
- node2.appendChild(importNode(doc,child,deep));
189678
- child = child.nextSibling;
189679
- }
189680
- }
189681
- return node2;
190154
+ /**
190155
+ * Imports a node from a different document into `doc`, creating a new copy.
190156
+ * Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
190157
+ * stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
190158
+ * Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
190159
+ * always forced to `true`
190160
+ * because an attribute's value lives in a child text node.
190161
+ *
190162
+ * @param {Document} doc
190163
+ * The document that will own the imported node.
190164
+ * @param {Node} node
190165
+ * The node to import.
190166
+ * @param {boolean} deep
190167
+ * If `true`, descendants are imported recursively.
190168
+ * @returns {Node}
190169
+ * The newly imported node, now owned by `doc`.
190170
+ */
190171
+ function importNode(doc, node, deep) {
190172
+ var destRoot;
190173
+ walkDOM(node, null, {
190174
+ enter: function (srcNode, destParent) {
190175
+ // Shallow-clone the node and stamp it into the target document.
190176
+ var destNode = srcNode.cloneNode(false);
190177
+ destNode.ownerDocument = doc;
190178
+ destNode.parentNode = null;
190179
+ // capture as the root of the imported subtree or attach to parent.
190180
+ if (destParent === null) {
190181
+ destRoot = destNode;
190182
+ } else {
190183
+ destParent.appendChild(destNode);
190184
+ }
190185
+ // ATTRIBUTE_NODE must always be imported deeply: its value lives in a child text node.
190186
+ var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
190187
+ return shouldDeep ? destNode : null;
190188
+ },
190189
+ });
190190
+ return destRoot;
189682
190191
  }
189683
190192
  //
189684
190193
  //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
189685
190194
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
189686
- function cloneNode(doc,node,deep){
189687
- var node2 = new node.constructor();
189688
- for (var n in node) {
189689
- if (Object.prototype.hasOwnProperty.call(node, n)) {
189690
- var v = node[n];
189691
- if (typeof v != "object") {
189692
- if (v != node2[n]) {
189693
- node2[n] = v;
190195
+ function cloneNode(doc, node, deep) {
190196
+ var destRoot;
190197
+ walkDOM(node, null, {
190198
+ enter: function (srcNode, destParent) {
190199
+ // 1. Create a blank node of the same type and copy all scalar own properties.
190200
+ var destNode = new srcNode.constructor();
190201
+ for (var n in srcNode) {
190202
+ if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
190203
+ var v = srcNode[n];
190204
+ if (typeof v != 'object') {
190205
+ if (v != destNode[n]) {
190206
+ destNode[n] = v;
190207
+ }
190208
+ }
189694
190209
  }
189695
190210
  }
189696
- }
189697
- }
189698
- if(node.childNodes){
189699
- node2.childNodes = new NodeList();
189700
- }
189701
- node2.ownerDocument = doc;
189702
- switch (node2.nodeType) {
189703
- case ELEMENT_NODE:
189704
- var attrs = node.attributes;
189705
- var attrs2 = node2.attributes = new NamedNodeMap();
189706
- var len = attrs.length;
189707
- attrs2._ownerElement = node2;
189708
- for(var i=0;i<len;i++){
189709
- node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
189710
- }
189711
- break; case ATTRIBUTE_NODE:
189712
- deep = true;
189713
- }
189714
- if(deep){
189715
- var child = node.firstChild;
189716
- while(child){
189717
- node2.appendChild(cloneNode(doc,child,deep));
189718
- child = child.nextSibling;
189719
- }
189720
- }
189721
- return node2;
190211
+ if (srcNode.childNodes) {
190212
+ destNode.childNodes = new NodeList();
190213
+ }
190214
+ destNode.ownerDocument = doc;
190215
+ // 2. Handle node-type-specific setup.
190216
+ // Attributes are not DOM children, so they are cloned inline here
190217
+ // rather than by walkDOM descent.
190218
+ // ATTRIBUTE_NODE forces deep=true so its own children are walked.
190219
+ var shouldDeep = deep;
190220
+ switch (destNode.nodeType) {
190221
+ case ELEMENT_NODE:
190222
+ var attrs = srcNode.attributes;
190223
+ var attrs2 = (destNode.attributes = new NamedNodeMap());
190224
+ var len = attrs.length;
190225
+ attrs2._ownerElement = destNode;
190226
+ for (var i = 0; i < len; i++) {
190227
+ destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
190228
+ }
190229
+ break;
190230
+ case ATTRIBUTE_NODE:
190231
+ shouldDeep = true;
190232
+ }
190233
+ // 3. Attach to parent, or capture as the root of the cloned subtree.
190234
+ if (destParent !== null) {
190235
+ destParent.appendChild(destNode);
190236
+ } else {
190237
+ destRoot = destNode;
190238
+ }
190239
+ // 4. Return destNode as the context for children (causes walkDOM to descend),
190240
+ // or null to skip children (shallow clone).
190241
+ return shouldDeep ? destNode : null;
190242
+ },
190243
+ });
190244
+ return destRoot;
189722
190245
  }
189723
190246
 
189724
190247
  function __set__(object,key,value){
@@ -189734,49 +190257,55 @@ function requireDom () {
189734
190257
  }
189735
190258
  });
189736
190259
 
189737
- Object.defineProperty(Node.prototype,'textContent',{
189738
- get:function(){
189739
- return getTextContent(this);
190260
+ /**
190261
+ * The text content of this node and its descendants.
190262
+ *
190263
+ * Setting `textContent` on an element or document fragment replaces all child nodes with a
190264
+ * single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
190265
+ *
190266
+ * @type {string | null}
190267
+ * @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
190268
+ */
190269
+ Object.defineProperty(Node.prototype, 'textContent', {
190270
+ get: function () {
190271
+ if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
190272
+ var buf = [];
190273
+ walkDOM(this, null, {
190274
+ enter: function (n) {
190275
+ if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
190276
+ return true; // enter children
190277
+ }
190278
+ if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
190279
+ return null; // excluded from text content
190280
+ }
190281
+ buf.push(n.nodeValue);
190282
+ },
190283
+ });
190284
+ return buf.join('');
190285
+ }
190286
+ return this.nodeValue;
189740
190287
  },
189741
190288
 
189742
- set:function(data){
189743
- switch(this.nodeType){
189744
- case ELEMENT_NODE:
189745
- case DOCUMENT_FRAGMENT_NODE:
189746
- while(this.firstChild){
189747
- this.removeChild(this.firstChild);
189748
- }
189749
- if(data || String(data)){
189750
- this.appendChild(this.ownerDocument.createTextNode(data));
189751
- }
189752
- break;
190289
+ set: function (data) {
190290
+ switch (this.nodeType) {
190291
+ case ELEMENT_NODE:
190292
+ case DOCUMENT_FRAGMENT_NODE:
190293
+ while (this.firstChild) {
190294
+ this.removeChild(this.firstChild);
190295
+ }
190296
+ if (data || String(data)) {
190297
+ this.appendChild(this.ownerDocument.createTextNode(data));
190298
+ }
190299
+ break;
189753
190300
 
189754
- default:
189755
- this.data = data;
189756
- this.value = data;
189757
- this.nodeValue = data;
190301
+ default:
190302
+ this.data = data;
190303
+ this.value = data;
190304
+ this.nodeValue = data;
189758
190305
  }
189759
- }
190306
+ },
189760
190307
  });
189761
190308
 
189762
- function getTextContent(node){
189763
- switch(node.nodeType){
189764
- case ELEMENT_NODE:
189765
- case DOCUMENT_FRAGMENT_NODE:
189766
- var buf = [];
189767
- node = node.firstChild;
189768
- while(node){
189769
- if(node.nodeType!==7 && node.nodeType !==8){
189770
- buf.push(getTextContent(node));
189771
- }
189772
- node = node.nextSibling;
189773
- }
189774
- return buf.join('');
189775
- default:
189776
- return node.nodeValue;
189777
- }
189778
- }
189779
-
189780
190309
  __set__ = function(object,key,value){
189781
190310
  //console.log(value)
189782
190311
  object['$$'+key] = value;
@@ -189792,6 +190321,7 @@ function requireDom () {
189792
190321
  dom.Element = Element;
189793
190322
  dom.Node = Node;
189794
190323
  dom.NodeList = NodeList;
190324
+ dom.walkDOM = walkDOM;
189795
190325
  dom.XMLSerializer = XMLSerializer;
189796
190326
  //}
189797
190327
  return dom;
@@ -192582,7 +193112,7 @@ function requireSax () {
192582
193112
  function parseInstruction(source,start,domBuilder){
192583
193113
  var end = source.indexOf('?>',start);
192584
193114
  if(end){
192585
- var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
193115
+ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
192586
193116
  if(match){
192587
193117
  match[0].length;
192588
193118
  domBuilder.processingInstruction(match[1], match[2]) ;
@@ -199469,7 +199999,7 @@ function requireMomentTimezone () {
199469
199999
  hasRequiredMomentTimezone = 1;
199470
200000
  (function (module) {
199471
200001
  //! moment-timezone.js
199472
- //! version : 0.6.0
200002
+ //! version : 0.6.1
199473
200003
  //! Copyright (c) JS Foundation and other contributors
199474
200004
  //! license : MIT
199475
200005
  //! github.com/moment/moment-timezone
@@ -199495,7 +200025,7 @@ function requireMomentTimezone () {
199495
200025
  // return moment;
199496
200026
  // }
199497
200027
 
199498
- var VERSION = "0.6.0",
200028
+ var VERSION = "0.6.1",
199499
200029
  zones = {},
199500
200030
  links = {},
199501
200031
  countries = {},