@angular/core 11.1.0 → 11.1.1

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 v11.1.0
2
+ * @license Angular v11.1.1
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -3324,6 +3324,12 @@
3324
3324
  */
3325
3325
  var BLOOM_SIZE = 256;
3326
3326
  var BLOOM_MASK = BLOOM_SIZE - 1;
3327
+ /**
3328
+ * The number of bits that is represented by a single bloom bucket. JS bit operations are 32 bits,
3329
+ * so each bucket represents 32 distinct tokens which accounts for log2(32) = 5 bits of a bloom hash
3330
+ * number.
3331
+ */
3332
+ var BLOOM_BUCKET_BITS = 5;
3327
3333
  /** Counter used to generate unique IDs for directives. */
3328
3334
  var nextNgElementId = 0;
3329
3335
  /**
@@ -3350,25 +3356,15 @@
3350
3356
  }
3351
3357
  // We only have BLOOM_SIZE (256) slots in our bloom filter (8 buckets * 32 bits each),
3352
3358
  // so all unique IDs must be modulo-ed into a number from 0 - 255 to fit into the filter.
3353
- var bloomBit = id & BLOOM_MASK;
3359
+ var bloomHash = id & BLOOM_MASK;
3354
3360
  // Create a mask that targets the specific bit associated with the directive.
3355
3361
  // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
3356
3362
  // to bit positions 0 - 31 in a 32 bit integer.
3357
- var mask = 1 << bloomBit;
3358
- // Use the raw bloomBit number to determine which bloom filter bucket we should check
3359
- // e.g: bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc
3360
- var b7 = bloomBit & 0x80;
3361
- var b6 = bloomBit & 0x40;
3362
- var b5 = bloomBit & 0x20;
3363
- var tData = tView.data;
3364
- if (b7) {
3365
- b6 ? (b5 ? (tData[injectorIndex + 7] |= mask) : (tData[injectorIndex + 6] |= mask)) :
3366
- (b5 ? (tData[injectorIndex + 5] |= mask) : (tData[injectorIndex + 4] |= mask));
3367
- }
3368
- else {
3369
- b6 ? (b5 ? (tData[injectorIndex + 3] |= mask) : (tData[injectorIndex + 2] |= mask)) :
3370
- (b5 ? (tData[injectorIndex + 1] |= mask) : (tData[injectorIndex] |= mask));
3371
- }
3363
+ var mask = 1 << bloomHash;
3364
+ // Each bloom bucket in `tData` represents `BLOOM_BUCKET_BITS` number of bits of `bloomHash`.
3365
+ // Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset that the mask
3366
+ // should be written to.
3367
+ tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;
3372
3368
  }
3373
3369
  /**
3374
3370
  * Creates (or gets an existing) injector for a given element or container.
@@ -3864,21 +3860,10 @@
3864
3860
  // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
3865
3861
  // to bit positions 0 - 31 in a 32 bit integer.
3866
3862
  var mask = 1 << bloomHash;
3867
- var b7 = bloomHash & 0x80;
3868
- var b6 = bloomHash & 0x40;
3869
- var b5 = bloomHash & 0x20;
3870
- // Our bloom filter size is 256 bits, which is eight 32-bit bloom filter buckets:
3871
- // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc.
3872
- // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
3873
- var value;
3874
- if (b7) {
3875
- value = b6 ? (b5 ? injectorView[injectorIndex + 7] : injectorView[injectorIndex + 6]) :
3876
- (b5 ? injectorView[injectorIndex + 5] : injectorView[injectorIndex + 4]);
3877
- }
3878
- else {
3879
- value = b6 ? (b5 ? injectorView[injectorIndex + 3] : injectorView[injectorIndex + 2]) :
3880
- (b5 ? injectorView[injectorIndex + 1] : injectorView[injectorIndex]);
3881
- }
3863
+ // Each bloom bucket in `injectorView` represents `BLOOM_BUCKET_BITS` number of bits of
3864
+ // `bloomHash`. Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset
3865
+ // that should be used.
3866
+ var value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];
3882
3867
  // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
3883
3868
  // this injector is a potential match.
3884
3869
  return !!(value & mask);
@@ -6591,14 +6576,26 @@
6591
6576
  * Use of this source code is governed by an MIT-style license that can be
6592
6577
  * found in the LICENSE file at https://angular.io/license
6593
6578
  */
6594
- var END_COMMENT = /-->/g;
6595
- var END_COMMENT_ESCAPED = '-\u200B-\u200B>';
6596
6579
  /**
6597
- * Escape the content of the strings so that it can be safely inserted into a comment node.
6580
+ * Disallowed strings in the comment.
6581
+ *
6582
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6583
+ */
6584
+ var COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6585
+ /**
6586
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6587
+ */
6588
+ var COMMENT_DELIMITER = /(<|>)/;
6589
+ var COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6590
+ /**
6591
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
6598
6592
  *
6599
6593
  * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6600
- * `<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text not
6601
- * an end to the comment. This can be created programmatically through DOM APIs.
6594
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6595
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6596
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6597
+ *
6598
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6602
6599
  *
6603
6600
  * ```
6604
6601
  * div.innerHTML = div.innerHTML
@@ -6609,15 +6606,16 @@
6609
6606
  * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6610
6607
  * may contain such text and expect them to be safe.)
6611
6608
  *
6612
- * This function escapes the comment text by looking for the closing char sequence `-->` and replace
6613
- * it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
6614
- * contains `-->` text it will render normally but it will not cause the HTML parser to close the
6615
- * comment.
6609
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6610
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6611
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6612
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
6616
6613
  *
6617
- * @param value text to make safe for comment node by escaping the comment close character sequence
6614
+ * @param value text to make safe for comment node by escaping the comment open/close character
6615
+ * sequence.
6618
6616
  */
6619
6617
  function escapeCommentText(value) {
6620
- return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
6618
+ return value.replace(COMMENT_DISALLOWED, function (text) { return text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED); });
6621
6619
  }
6622
6620
 
6623
6621
  /**
@@ -9021,8 +9019,21 @@
9021
9019
  TNode.prototype.debugNodeInjectorPath = function (lView) {
9022
9020
  var path = [];
9023
9021
  var injectorIndex = getInjectorIndex(this, lView);
9024
- ngDevMode && assertNodeInjector(lView, injectorIndex);
9022
+ if (injectorIndex === -1) {
9023
+ // Looks like the current `TNode` does not have `NodeInjector` associated with it => look for
9024
+ // parent NodeInjector.
9025
+ var parentLocation = getParentInjectorLocation(this, lView);
9026
+ if (parentLocation !== NO_PARENT_INJECTOR) {
9027
+ // We found a parent, so start searching from the parent location.
9028
+ injectorIndex = getParentInjectorIndex(parentLocation);
9029
+ lView = getParentInjectorView(parentLocation, lView);
9030
+ }
9031
+ else {
9032
+ // No parents have been found, so there are no `NodeInjector`s to consult.
9033
+ }
9034
+ }
9025
9035
  while (injectorIndex !== -1) {
9036
+ ngDevMode && assertNodeInjector(lView, injectorIndex);
9026
9037
  var tNode = lView[TVIEW].data[injectorIndex + 8 /* TNODE */];
9027
9038
  path.push(buildDebugNode(tNode, lView));
9028
9039
  var parentLocation = lView[injectorIndex + 8 /* PARENT */];
@@ -9479,11 +9490,15 @@
9479
9490
  return {
9480
9491
  html: toHtml(native),
9481
9492
  type: toTNodeTypeAsString(tNode.type),
9493
+ tNode: tNode,
9482
9494
  native: native,
9483
9495
  children: toDebugNodes(tNode.child, lView),
9484
9496
  factories: factories,
9485
9497
  instances: instances,
9486
- injector: buildNodeInjectorDebug(tNode, tView, lView)
9498
+ injector: buildNodeInjectorDebug(tNode, tView, lView),
9499
+ get injectorResolutionPath() {
9500
+ return tNode.debugNodeInjectorPath(lView);
9501
+ },
9487
9502
  };
9488
9503
  }
9489
9504
  function buildNodeInjectorDebug(tNode, tView, lView) {
@@ -9527,6 +9542,9 @@
9527
9542
  * @param idx
9528
9543
  */
9529
9544
  function toBloom(array, idx) {
9545
+ if (idx < 0) {
9546
+ return 'NO_NODE_INJECTOR';
9547
+ }
9530
9548
  return binary(array, idx + 7) + "_" + binary(array, idx + 6) + "_" + binary(array, idx + 5) + "_" + binary(array, idx + 4) + "_" + binary(array, idx + 3) + "_" + binary(array, idx + 2) + "_" + binary(array, idx + 1) + "_" + binary(array, idx + 0);
9531
9549
  }
9532
9550
  var LContainerDebug = /** @class */ (function () {
@@ -21914,7 +21932,7 @@
21914
21932
  /**
21915
21933
  * @publicApi
21916
21934
  */
21917
- var VERSION = new Version('11.1.0');
21935
+ var VERSION = new Version('11.1.1');
21918
21936
 
21919
21937
  /**
21920
21938
  * @license
@@ -28737,7 +28755,7 @@
28737
28755
  * found in the LICENSE file at https://angular.io/license
28738
28756
  */
28739
28757
  /**
28740
- * Combination of NgModuleFactory and ComponentFactorys.
28758
+ * Combination of NgModuleFactory and ComponentFactories.
28741
28759
  *
28742
28760
  * @publicApi
28743
28761
  */