@angular/platform-server 22.1.5 → 22.1.7

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.
@@ -758,6 +758,18 @@ function requireNodeUtils () {
758
758
  NOFRAMES: true
759
759
  };
760
760
 
761
+ // HTML's *escapable raw text* elements (a.k.a. RCDATA). Unlike the raw-text
762
+ // elements above, their text content IS escaped for character references --
763
+ // but the element is still terminated only by its own closing tag. So any
764
+ // payload that we emit verbatim underneath one of them (comment data,
765
+ // processing-instruction data, or the serialization of a nested raw-content
766
+ // element) must have that closing tag escaped, or it breaks the element open.
767
+ // https://html.spec.whatwg.org/multipage/syntax.html#escapable-raw-text-elements
768
+ var hasEscapableRawContent = {
769
+ TEXTAREA: true,
770
+ TITLE: true
771
+ };
772
+
761
773
  var emptyElements = {
762
774
  area: true,
763
775
  base: true,
@@ -779,14 +791,6 @@ function requireNodeUtils () {
779
791
  wbr: true
780
792
  };
781
793
 
782
- var extraNewLine = {
783
- /* Removed in https://github.com/whatwg/html/issues/944
784
- pre: true,
785
- textarea: true,
786
- listing: true
787
- */
788
- };
789
-
790
794
  const ESCAPE_REGEXP = /[&<>\u00A0]/g;
791
795
  const ESCAPE_ATTR_REGEXP = /[&"<>\u00A0]/g;
792
796
 
@@ -848,12 +852,22 @@ function requireNodeUtils () {
848
852
  return a.name;
849
853
  }
850
854
 
855
+ function serializedTagName(node) {
856
+ var ns = node.namespaceURI;
857
+ return (ns === NAMESPACE.HTML || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML)
858
+ ? node.localName
859
+ : node.tagName;
860
+ }
861
+
851
862
  function fallbackRawContentTags(node) {
852
863
  const tags = [];
853
864
  while (node) {
854
865
  if (node.nodeType === 1 /*ELEMENT_NODE*/) {
855
- if (node.namespaceURI === NAMESPACE.HTML && hasRawContentFallback[node.tagName]) {
856
- tags.push(node.localName);
866
+ const tagname = serializedTagName(node);
867
+ if (tagname &&
868
+ (hasRawContentFallback[tagname.toUpperCase()] ||
869
+ hasEscapableRawContent[tagname.toUpperCase()])) {
870
+ tags.push(tagname);
857
871
  }
858
872
  node = node.parentNode;
859
873
  } else if (node.nodeType === 11 /*DOCUMENT_FRAGMENT_NODE*/ && node._host) {
@@ -996,7 +1010,7 @@ function requireNodeUtils () {
996
1010
  case 1: //ELEMENT_NODE
997
1011
  var ns = kid.namespaceURI;
998
1012
  var html = ns === NAMESPACE.HTML;
999
- var tagname = (html || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML) ? kid.localName : kid.tagName;
1013
+ var tagname = serializedTagName(kid);
1000
1014
 
1001
1015
  s += '<' + tagname;
1002
1016
 
@@ -1019,7 +1033,6 @@ function requireNodeUtils () {
1019
1033
  ss = escapeMatchingClosingTag(ss, fallbackTag);
1020
1034
  }
1021
1035
  }
1022
- if (html && extraNewLine[tagname] && ss.charAt(0)==='\n') s += '\n';
1023
1036
  // Serialize children and add end tag for all others
1024
1037
  s += ss;
1025
1038
  s += '</' + tagname + '>';
@@ -11437,6 +11450,8 @@ function requireHTMLParser () {
11437
11450
  for(var i = 0, n = oldattrs.length; i < n; i++) {
11438
11451
  var oldname = oldattrs[i][0];
11439
11452
  var oldval = oldattrs[i][1];
11453
+ // Bare attributes have an empty string value in the DOM.
11454
+ if (oldval === undefined) oldval = "";
11440
11455
  if (!newelt.hasAttribute(oldname)) return false;
11441
11456
  if (newelt.getAttribute(oldname) !== oldval) return false;
11442
11457
  }
@@ -14258,6 +14273,8 @@ function requireHTMLParser () {
14258
14273
  emitDoctype();
14259
14274
  break;
14260
14275
  case -1: // EOF
14276
+ // Lookahead states must consume the EOF marker explicitly.
14277
+ nextchar += 1;
14261
14278
  forcequirks();
14262
14279
  emitDoctype();
14263
14280
  emitEOF();