@angular/core 10.2.4 → 10.2.5

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v10.2.4
2
+ * @license Angular v10.2.5
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -5670,14 +5670,26 @@
5670
5670
  * Use of this source code is governed by an MIT-style license that can be
5671
5671
  * found in the LICENSE file at https://angular.io/license
5672
5672
  */
5673
- var END_COMMENT = /-->/g;
5674
- var END_COMMENT_ESCAPED = '-\u200B-\u200B>';
5675
5673
  /**
5676
- * Escape the content of the strings so that it can be safely inserted into a comment node.
5674
+ * Disallowed strings in the comment.
5675
+ *
5676
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
5677
+ */
5678
+ var COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
5679
+ /**
5680
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
5681
+ */
5682
+ var COMMENT_DELIMITER = /(<|>)/;
5683
+ var COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
5684
+ /**
5685
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
5677
5686
  *
5678
5687
  * The issue is that HTML does not specify any way to escape comment end text inside the comment.
5679
- * `<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text not
5680
- * an end to the comment. This can be created programmatically through DOM APIs.
5688
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
5689
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
5690
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
5691
+ *
5692
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
5681
5693
  *
5682
5694
  * ```
5683
5695
  * div.innerHTML = div.innerHTML
@@ -5688,15 +5700,16 @@
5688
5700
  * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
5689
5701
  * may contain such text and expect them to be safe.)
5690
5702
  *
5691
- * This function escapes the comment text by looking for the closing char sequence `-->` and replace
5692
- * it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
5693
- * contains `-->` text it will render normally but it will not cause the HTML parser to close the
5694
- * comment.
5703
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
5704
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
5705
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
5706
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
5695
5707
  *
5696
- * @param value text to make safe for comment node by escaping the comment close character sequence
5708
+ * @param value text to make safe for comment node by escaping the comment open/close character
5709
+ * sequence.
5697
5710
  */
5698
5711
  function escapeCommentText(value) {
5699
- return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
5712
+ return value.replace(COMMENT_DISALLOWED, function (text) { return text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED); });
5700
5713
  }
5701
5714
 
5702
5715
  /**
@@ -21727,7 +21740,7 @@
21727
21740
  /**
21728
21741
  * @publicApi
21729
21742
  */
21730
- var VERSION = new Version('10.2.4');
21743
+ var VERSION = new Version('10.2.5');
21731
21744
 
21732
21745
  /**
21733
21746
  * @license