@wavemaker/angular-codegen 11.14.1-26.647686 → 11.14.1-28.647720

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.
@@ -37685,11 +37685,22 @@ function requireConventions () {
37685
37685
  XMLNS: 'http://www.w3.org/2000/xmlns/',
37686
37686
  });
37687
37687
 
37688
+ //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
37689
+ //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
37690
+ //[5] Name ::= NameStartChar (NameChar)*
37691
+ var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
37692
+ var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
37693
+ var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
37694
+ //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
37695
+
37688
37696
  conventions.assign = assign;
37689
37697
  conventions.find = find;
37690
37698
  conventions.freeze = freeze;
37691
37699
  conventions.MIME_TYPE = MIME_TYPE;
37692
37700
  conventions.NAMESPACE = NAMESPACE;
37701
+ conventions.nameStartChar = nameStartChar;
37702
+ conventions.nameChar = nameChar;
37703
+ conventions.tagNamePattern = tagNamePattern;
37693
37704
  return conventions;
37694
37705
  }
37695
37706
 
@@ -37702,6 +37713,7 @@ function requireDom () {
37702
37713
 
37703
37714
  var find = conventions.find;
37704
37715
  var NAMESPACE = conventions.NAMESPACE;
37716
+ var tagNamePattern = conventions.tagNamePattern;
37705
37717
 
37706
37718
  /**
37707
37719
  * A prerequisite for `[].filter`, to drop elements that are empty
@@ -37933,6 +37945,13 @@ function requireDom () {
37933
37945
  * used for attributes or DocumentType entities
37934
37946
  */
37935
37947
  function NamedNodeMap() {
37948
+ // nodeName -> Attr membership index; lets the parse-time de-duplication in
37949
+ // setNamedItem resolve an existing attribute in O(1) instead of scanning the
37950
+ // list, so building an element with M attributes costs O(M) rather than O(M^2).
37951
+ // The numbered entries and length remain the sole authority for attribute order.
37952
+ // Object.create(null) so an attribute named __proto__ or constructor is an
37953
+ // ordinary key.
37954
+ this._nameIndex = Object.create(null);
37936
37955
  }
37937
37956
  function _findNodeIndex(list,node){
37938
37957
  var i = list.length;
@@ -37941,12 +37960,27 @@ function requireDom () {
37941
37960
  }
37942
37961
  }
37943
37962
 
37963
+ function _nnmIndexAdd(list, attr) {
37964
+ list._nameIndex[attr.nodeName] = attr;
37965
+ }
37966
+ function _nnmIndexRemove(list, attr) {
37967
+ // Only drop the entry if it still points at this attribute; a replacement with
37968
+ // a different nodeName may already have re-keyed it.
37969
+ if (list._nameIndex[attr.nodeName] === attr) {
37970
+ delete list._nameIndex[attr.nodeName];
37971
+ }
37972
+ }
37973
+
37944
37974
  function _addNamedNode(el,list,newAttr,oldAttr){
37945
37975
  if(oldAttr){
37946
37976
  list[_findNodeIndex(list,oldAttr)] = newAttr;
37977
+ // oldAttr leaves the list; drop its index entry (its nodeName may differ
37978
+ // from newAttr's when the replacement came via setNamedItemNS).
37979
+ _nnmIndexRemove(list, oldAttr);
37947
37980
  }else {
37948
37981
  list[list.length++] = newAttr;
37949
37982
  }
37983
+ _nnmIndexAdd(list, newAttr);
37950
37984
  if(el){
37951
37985
  newAttr.ownerElement = el;
37952
37986
  var doc = el.ownerDocument;
@@ -37965,6 +37999,7 @@ function requireDom () {
37965
37999
  list[i] = list[++i];
37966
38000
  }
37967
38001
  list.length = lastIndex;
38002
+ _nnmIndexRemove(list, attr);
37968
38003
  if(el){
37969
38004
  var doc = el.ownerDocument;
37970
38005
  if(doc){
@@ -37998,7 +38033,11 @@ function requireDom () {
37998
38033
  if(el && el!=this._ownerElement){
37999
38034
  throw new DOMException(INUSE_ATTRIBUTE_ERR);
38000
38035
  }
38001
- var oldAttr = this.getNamedItem(attr.nodeName);
38036
+ // Resolve any existing attribute with the same nodeName through the O(1)
38037
+ // membership index rather than an O(M) scan — this is the parse-dedup hot
38038
+ // path (setAttributeNode per attribute during parse). Absent -> undefined,
38039
+ // matching getNamedItem's contract.
38040
+ var oldAttr = this._nameIndex[attr.nodeName];
38002
38041
  _addNamedNode(this._ownerElement,this,attr,oldAttr);
38003
38042
  return oldAttr;
38004
38043
  },
@@ -38231,9 +38270,38 @@ function requireDom () {
38231
38270
  while (child) {
38232
38271
  var next = child.nextSibling;
38233
38272
  if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
38234
- node.removeChild(next);
38235
- child.appendData(next.data);
38236
- // Do not advance child: re-check new nextSibling for another text run
38273
+ // Merge the whole run of adjacent text nodes at once: gather the
38274
+ // following text siblings' data, unlink them in a single pass, and
38275
+ // re-index the child list a single time. Per-sibling `removeChild`
38276
+ // (each an O(K) re-index) plus per-sibling `appendData` (each an O(K)
38277
+ // string rebuild) is O(K^2) over a long run of single-character text
38278
+ // nodes; this keeps it O(K). The first text node of the run survives
38279
+ // and carries the concatenated data, preserving node identity and
38280
+ // locator semantics.
38281
+ var tail = [];
38282
+ var sibling = next;
38283
+ while (sibling !== null && sibling.nodeType === TEXT_NODE) {
38284
+ tail.push(sibling.data);
38285
+ sibling = sibling.nextSibling;
38286
+ }
38287
+ // `sibling` is now the first non-text node after the run, or null.
38288
+ var removed = child.nextSibling;
38289
+ while (removed !== sibling) {
38290
+ var following = removed.nextSibling;
38291
+ removed.parentNode = null;
38292
+ removed.previousSibling = null;
38293
+ removed.nextSibling = null;
38294
+ removed = following;
38295
+ }
38296
+ child.nextSibling = sibling;
38297
+ if (sibling !== null) {
38298
+ sibling.previousSibling = child;
38299
+ } else {
38300
+ node.lastChild = child;
38301
+ }
38302
+ child.appendData(tail.join('')); // single O(K) string rebuild
38303
+ _onUpdateChild(node.ownerDocument, node); // single O(K) re-index
38304
+ child = sibling;
38237
38305
  } else {
38238
38306
  child = next;
38239
38307
  }
@@ -39044,8 +39112,10 @@ function requireDom () {
39044
39112
  * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
39045
39113
  *
39046
39114
  * Note: When the resulting document is serialized with `requireWellFormed: true`, the
39047
- * serializer throws with code `INVALID_STATE_ERR` if `.data` contains `?>` (W3C DOM Parsing
39048
- * §3.2.1.7). Without that option the data is emitted verbatim.
39115
+ * serializer throws with code `INVALID_STATE_ERR` if `.target` is not a valid XML `NCName`
39116
+ * (a `Name` with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data`
39117
+ * contains `?>` (W3C DOM Parsing §3.2.1.7). Without that option the target and data are
39118
+ * emitted verbatim.
39049
39119
  *
39050
39120
  * @param {string} target
39051
39121
  * @param {string} data
@@ -39070,7 +39140,27 @@ function requireDom () {
39070
39140
  node.specified = true;
39071
39141
  return node;
39072
39142
  },
39143
+ /**
39144
+ * Creates an EntityReference object, serialized as `&name;`.
39145
+ *
39146
+ * The `name` is validated against the XML `Name` production at creation time; an invalid name
39147
+ * throws a `DOMException` with code `INVALID_CHARACTER_ERR`. When the resulting node is
39148
+ * serialized with `requireWellFormed: true`, the serializer re-validates `nodeName` and throws
39149
+ * a `DOMException` with code `INVALID_STATE_ERR` if a later `nodeName` mutation made it invalid;
39150
+ * without that option the name is emitted verbatim.
39151
+ *
39152
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
39153
+ * constructs `EntityReference` nodes, so this method is the only producer.
39154
+ *
39155
+ * @param {string} name The name of the entity to reference.
39156
+ * @returns {EntityReference}
39157
+ * @throws {DOMException} With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`.
39158
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
39159
+ */
39073
39160
  createEntityReference : function(name){
39161
+ if (!tagNamePattern.test(name)) {
39162
+ throw new DOMException(INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
39163
+ }
39074
39164
  var node = new EntityReference();
39075
39165
  node.ownerDocument = this;
39076
39166
  node.nodeName = name;
@@ -39282,15 +39372,16 @@ function requireDom () {
39282
39372
  /**
39283
39373
  * Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
39284
39374
  *
39285
- * `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
39375
+ * `name`, `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
39286
39376
  * xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
39287
39377
  * direct property writes succeed silently. Values are serialized verbatim when
39288
39378
  * `requireWellFormed` is false (the default). When the serializer is invoked with
39289
39379
  * `requireWellFormed: true` (via the 4th-parameter options object), it validates each
39290
- * field and throws `DOMException` with code `INVALID_STATE_ERR` on invalid values.
39380
+ * field — including `name`, which is checked against the XML `Name` production — and throws
39381
+ * `DOMException` with code `INVALID_STATE_ERR` on invalid values.
39291
39382
  *
39292
39383
  * @class
39293
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentType MDN
39384
+ * @see https://developer.mozilla.org/docs/Web/API/DocumentType MDN
39294
39385
  */
39295
39386
  function DocumentType() {
39296
39387
  } DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
@@ -39304,6 +39395,20 @@ function requireDom () {
39304
39395
  } Entity.prototype.nodeType = ENTITY_NODE;
39305
39396
  _extends(Entity,Node);
39306
39397
 
39398
+ /**
39399
+ * Represents an EntityReference node, serialized as `&nodeName;`.
39400
+ *
39401
+ * `nodeName` is the referenced entity's name, stored verbatim. When serialized with
39402
+ * `requireWellFormed: true`, the serializer validates `nodeName` against the XML `Name` production
39403
+ * and throws a `DOMException` with code `INVALID_STATE_ERR` if it does not match; without that
39404
+ * option the name is emitted verbatim between `&` and `;`.
39405
+ *
39406
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
39407
+ * constructs `EntityReference` nodes, so the only producer is `Document.createEntityReference`.
39408
+ *
39409
+ * @class
39410
+ * @see https://www.w3.org/TR/xml/#NT-Name
39411
+ */
39307
39412
  function EntityReference() {
39308
39413
  } EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
39309
39414
  _extends(EntityReference,Node);
@@ -39341,14 +39446,20 @@ function requireDom () {
39341
39446
  * @returns {string}
39342
39447
  * @throws {DOMException}
39343
39448
  * With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
39449
+ * - an Element's qualified name (including any namespace prefix) is not a valid XML QName,
39450
+ * - an attribute's qualified name (including a synthesized `xmlns:` namespace declaration) is
39451
+ * not a valid XML QName,
39344
39452
  * - a CDATASection node's data contains `"]]>"`,
39345
39453
  * - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
39346
- * - a ProcessingInstruction's data contains `"?>"`,
39454
+ * - a ProcessingInstruction's target is not a valid XML `NCName` (a `Name` with no colon) or is
39455
+ * an ASCII case-insensitive match for `"xml"`, or its data contains `"?>"`,
39456
+ * - a DocumentType's `name` is not a valid XML `Name` (XML 1.0 production [5]),
39347
39457
  * - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
39348
39458
  * production,
39349
39459
  * - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
39350
- * production, or
39351
- * - a DocumentType's `internalSubset` contains `"]>"`.
39460
+ * production,
39461
+ * - a DocumentType's `internalSubset` contains `"]>"`, or
39462
+ * - an EntityReference's `nodeName` is not a valid XML `Name` (XML 1.0 production [5]).
39352
39463
  * Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
39353
39464
  * writes succeed and are covered by the serializer-level checks above.
39354
39465
  * @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
@@ -39422,7 +39533,10 @@ function requireDom () {
39422
39533
  * @see https://www.w3.org/TR/xml11/#AVNormalize
39423
39534
  * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
39424
39535
  */
39425
- function addSerializedAttribute(buf, qualifiedName, value) {
39536
+ function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
39537
+ if (requireWellFormed && !tagNamePattern.test(qualifiedName)) {
39538
+ throw new DOMException(INVALID_STATE_ERR, 'The attribute name "' + qualifiedName + '" is not a valid XML QName');
39539
+ }
39426
39540
  buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
39427
39541
  }
39428
39542
 
@@ -39488,6 +39602,9 @@ function requireDom () {
39488
39602
  }
39489
39603
  }
39490
39604
 
39605
+ if (requireWellFormed && !tagNamePattern.test(prefixedNodeName)) {
39606
+ throw new DOMException(INVALID_STATE_ERR, 'The element name "' + prefixedNodeName + '" is not a valid XML QName');
39607
+ }
39491
39608
  buf.push('<', prefixedNodeName);
39492
39609
 
39493
39610
  // Build a fresh namespace snapshot for this element's children.
@@ -39507,7 +39624,7 @@ function requireDom () {
39507
39624
  if (needNamespaceDefine(attr, html, childNs)) {
39508
39625
  var attrPrefix = attr.prefix || '';
39509
39626
  var uri = attr.namespaceURI;
39510
- addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri);
39627
+ addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri, requireWellFormed);
39511
39628
  childNs.push({ prefix: attrPrefix, namespace: uri });
39512
39629
  }
39513
39630
  // Apply nodeFilter and serialize the attribute.
@@ -39516,7 +39633,7 @@ function requireDom () {
39516
39633
  if (typeof filteredAttr === 'string') {
39517
39634
  buf.push(filteredAttr);
39518
39635
  } else {
39519
- addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
39636
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
39520
39637
  }
39521
39638
  }
39522
39639
  }
@@ -39525,7 +39642,7 @@ function requireDom () {
39525
39642
  if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
39526
39643
  var nodePrefix = n.prefix || '';
39527
39644
  var uri = n.namespaceURI;
39528
- addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri);
39645
+ addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri, requireWellFormed);
39529
39646
  childNs.push({ prefix: nodePrefix, namespace: uri });
39530
39647
  }
39531
39648
 
@@ -39558,7 +39675,7 @@ function requireDom () {
39558
39675
  return { ns: ns.slice(), isHTML: html, tag: null };
39559
39676
 
39560
39677
  case ATTRIBUTE_NODE:
39561
- addSerializedAttribute(buf, n.name, n.value);
39678
+ addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
39562
39679
  return null;
39563
39680
 
39564
39681
  case TEXT_NODE:
@@ -39597,6 +39714,9 @@ function requireDom () {
39597
39714
 
39598
39715
  case DOCUMENT_TYPE_NODE:
39599
39716
  if (requireWellFormed) {
39717
+ if (!tagNamePattern.test(n.name)) {
39718
+ throw new DOMException(INVALID_STATE_ERR, 'The doctype name "' + n.name + '" is not a valid XML Name');
39719
+ }
39600
39720
  if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
39601
39721
  throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
39602
39722
  }
@@ -39628,13 +39748,27 @@ function requireDom () {
39628
39748
  return null;
39629
39749
 
39630
39750
  case PROCESSING_INSTRUCTION_NODE:
39631
- if (requireWellFormed && n.data.indexOf('?>') !== -1) {
39632
- throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
39751
+ if (requireWellFormed) {
39752
+ if (!tagNamePattern.test(n.target) || n.target.indexOf(':') !== -1 || n.target.toLowerCase() === 'xml') {
39753
+ throw new DOMException(
39754
+ INVALID_STATE_ERR,
39755
+ 'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved'
39756
+ );
39757
+ }
39758
+ if (n.data.indexOf('?>') !== -1) {
39759
+ throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
39760
+ }
39633
39761
  }
39634
39762
  buf.push('<?', n.target, ' ', n.data, '?>');
39635
39763
  return null;
39636
39764
 
39637
39765
  case ENTITY_REFERENCE_NODE:
39766
+ if (requireWellFormed && !tagNamePattern.test(n.nodeName)) {
39767
+ throw new DOMException(
39768
+ INVALID_STATE_ERR,
39769
+ 'The entity reference name "' + n.nodeName + '" is not a valid XML Name'
39770
+ );
39771
+ }
39638
39772
  buf.push('&', n.nodeName, ';');
39639
39773
  return null;
39640
39774
 
@@ -42015,14 +42149,8 @@ function requireSax () {
42015
42149
  if (hasRequiredSax) return sax;
42016
42150
  hasRequiredSax = 1;
42017
42151
  var NAMESPACE = requireConventions().NAMESPACE;
42152
+ var tagNamePattern = requireConventions().tagNamePattern;
42018
42153
 
42019
- //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
42020
- //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
42021
- //[5] Name ::= NameStartChar (NameChar)*
42022
- var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
42023
- var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
42024
- var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
42025
- //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
42026
42154
  //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
42027
42155
 
42028
42156
  //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
@@ -42133,7 +42261,13 @@ function requireSax () {
42133
42261
  switch(source.charAt(tagStart+1)){
42134
42262
  case '/':
42135
42263
  var end = source.indexOf('>',tagStart+3);
42136
- var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
42264
+ // Anchored trailing-whitespace trim. The former `/[ \t\n\r]+$/g` backtracked
42265
+ // quadratically on a name shaped `whitespace-run + non-whitespace char`
42266
+ // (an end tag `</ … x>`): from every start position it extended `[ws]+`
42267
+ // to the end and then failed the `$` anchor. This anchored form matches the
42268
+ // whole string once and captures everything up to the last non-whitespace
42269
+ // character, so it trims in linear time with byte-identical output.
42270
+ var tagName = source.substring(tagStart + 2, end).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/, '$1');
42137
42271
  var config = parseStack.pop();
42138
42272
  if(end<0){
42139
42273
 
@@ -42144,6 +42278,14 @@ function requireSax () {
42144
42278
  tagName = tagName.replace(/[\s<].*/,'');
42145
42279
  errorHandler.error("end tag name: "+tagName+' maybe not complete');
42146
42280
  end = tagStart+1+tagName.length;
42281
+ }else if(/[ \t\n\r]/.test(tagName) && tagNamePattern.test(tagName.split(/[ \t\n\r]/)[0])){
42282
+ // The XML `ETag` production is `'</' Name S? '>'`: only optional whitespace may follow
42283
+ // the `Name`. A valid `Name` followed by whitespace and non-whitespace residue (e.g.
42284
+ // `</a\nbogus>` or `</a bogus>`) is not well-formed, but historically it was silently
42285
+ // accepted (the malformed end tag ignored, the residue dropped, the element left on the
42286
+ // stack). Report it as a recoverable `error` (which a custom errorHandler may escalate to
42287
+ // fatal) while keeping the existing recovery so the parsed DOM stays byte-identical.
42288
+ errorHandler.error('end tag name is followed by whitespace and trailing content: "'+tagName+'"');
42147
42289
  }
42148
42290
  var localNSMap = config.localNSMap;
42149
42291
  var endMatch = config.tagName == tagName;
@@ -42267,6 +42409,15 @@ function requireSax () {
42267
42409
  var s = S_TAG;//status
42268
42410
  while(true){
42269
42411
  var c = source.charAt(p);
42412
+ if (s === S_TAG && c === '<') {
42413
+ // A `<` can never occur inside a tag name. Without this guard the scan runs
42414
+ // on to the next `>` (or EOF) before the tag name is rejected, so a document
42415
+ // with many `<` inside a malformed tag makes each one-character recovery step
42416
+ // re-scan to the distant `>` — O(n^2). Stopping at the `<` keeps each recovery
42417
+ // step bounded. The candidate scanned so far is reported raw, consistent with
42418
+ // the sibling invalid-tag-name throw below.
42419
+ throw new Error('unexpected < in tag name: ' + source.slice(start, p));
42420
+ }
42270
42421
  switch(c){
42271
42422
  case '=':
42272
42423
  if(s === S_ATTR){//attrName
@@ -42459,9 +42610,13 @@ function requireSax () {
42459
42610
  if(nsPrefix !== false){//hack!!
42460
42611
  if(localNSMap == null){
42461
42612
  localNSMap = {};
42462
- //console.log(currentNSMap,0)
42463
- _copy(currentNSMap,currentNSMap={});
42464
- //console.log(currentNSMap,1)
42613
+ // Derive the child scope's namespace map by prototype-chain inheritance
42614
+ // instead of a flat copy: lookups inherit ancestor prefixes transparently,
42615
+ // so a document nesting N scopes retains O(N) map entries rather than
42616
+ // sum(1..N) = O(N^2). localNSMap stays a flat own-only record of the
42617
+ // prefixes declared at THIS element, so own-property enumeration
42618
+ // (endPrefixMapping below) still reports only local declarations.
42619
+ currentNSMap = Object.create(currentNSMap);
42465
42620
  }
42466
42621
  currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
42467
42622
  a.uri = NAMESPACE.XMLNS;