@angular/core 11.2.12 → 11.2.13

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.
package/fesm2015/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v11.2.12
2
+ * @license Angular v11.2.13
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -20167,7 +20167,7 @@ function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNode
20167
20167
  const hasBinding = text.match(BINDING_REGEXP);
20168
20168
  const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
20169
20169
  if (hasBinding) {
20170
- generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index);
20170
+ generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index, null, 0, null);
20171
20171
  }
20172
20172
  }
20173
20173
  /**
@@ -20195,7 +20195,9 @@ function i18nAttributesFirstPass(tView, index, values) {
20195
20195
  }
20196
20196
  // i18n attributes that hit this code path are guaranteed to have bindings, because
20197
20197
  // the compiler treats static i18n attributes as regular attribute bindings.
20198
- generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName);
20198
+ // Since this may not be the first i18n attribute on this element we need to pass in how
20199
+ // many previous bindings there have already been.
20200
+ generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
20199
20201
  }
20200
20202
  }
20201
20203
  tView.data[index] = updateOpCodes;
@@ -20209,8 +20211,10 @@ function i18nAttributesFirstPass(tView, index, values) {
20209
20211
  * @param destinationNode Index of the destination node which will receive the binding.
20210
20212
  * @param attrName Name of the attribute, if the string belongs to an attribute.
20211
20213
  * @param sanitizeFn Sanitization function used to sanitize the string after update, if necessary.
20214
+ * @param bindingStart The lView index of the next expression that can be bound via an opCode.
20215
+ * @returns The mask value for these bindings
20212
20216
  */
20213
- function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, sanitizeFn = null) {
20217
+ function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
20214
20218
  ngDevMode &&
20215
20219
  assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, 'Index must be in absolute LView offset');
20216
20220
  const maskIndex = updateOpCodes.length; // Location of mask
@@ -20226,7 +20230,7 @@ function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrN
20226
20230
  const textValue = textParts[j];
20227
20231
  if (j & 1) {
20228
20232
  // Odd indexes are bindings
20229
- const bindingIndex = parseInt(textValue, 10);
20233
+ const bindingIndex = bindingStart + parseInt(textValue, 10);
20230
20234
  updateOpCodes.push(-1 - bindingIndex);
20231
20235
  mask = mask | toMaskBit(bindingIndex);
20232
20236
  }
@@ -20244,6 +20248,28 @@ function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrN
20244
20248
  updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
20245
20249
  return mask;
20246
20250
  }
20251
+ /**
20252
+ * Count the number of bindings in the given `opCodes`.
20253
+ *
20254
+ * It could be possible to speed this up, by passing the number of bindings found back from
20255
+ * `generateBindingUpdateOpCodes()` to `i18nAttributesFirstPass()` but this would then require more
20256
+ * complexity in the code and/or transient objects to be created.
20257
+ *
20258
+ * Since this function is only called once when the template is instantiated, is trivial in the
20259
+ * first instance (since `opCodes` will be an empty array), and it is not common for elements to
20260
+ * contain multiple i18n bound attributes, it seems like this is a reasonable compromise.
20261
+ */
20262
+ function countBindings(opCodes) {
20263
+ let count = 0;
20264
+ for (let i = 0; i < opCodes.length; i++) {
20265
+ const opCode = opCodes[i];
20266
+ // Bindings are negative numbers.
20267
+ if (typeof opCode === 'number' && opCode < 0) {
20268
+ count++;
20269
+ }
20270
+ }
20271
+ return count;
20272
+ }
20247
20273
  /**
20248
20274
  * Convert binding index to mask bit.
20249
20275
  *
@@ -20495,13 +20521,13 @@ function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, up
20495
20521
  if (hasBinding) {
20496
20522
  if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
20497
20523
  if (URI_ATTRS[lowerAttrName]) {
20498
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, _sanitizeUrl);
20524
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
20499
20525
  }
20500
20526
  else if (SRCSET_ATTRS[lowerAttrName]) {
20501
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, sanitizeSrcset);
20527
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, sanitizeSrcset);
20502
20528
  }
20503
20529
  else {
20504
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name);
20530
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
20505
20531
  }
20506
20532
  }
20507
20533
  else {
@@ -20527,7 +20553,8 @@ function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, up
20527
20553
  addCreateNodeAndAppend(create, null, hasBinding ? '' : value, parentIdx, newIndex);
20528
20554
  addRemoveNode(remove, newIndex, depth);
20529
20555
  if (hasBinding) {
20530
- bindingMask = generateBindingUpdateOpCodes(update, value, newIndex) | bindingMask;
20556
+ bindingMask =
20557
+ generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
20531
20558
  }
20532
20559
  break;
20533
20560
  case Node.COMMENT_NODE:
@@ -21419,7 +21446,7 @@ class Version {
21419
21446
  /**
21420
21447
  * @publicApi
21421
21448
  */
21422
- const VERSION = new Version('11.2.12');
21449
+ const VERSION = new Version('11.2.13');
21423
21450
 
21424
21451
  /**
21425
21452
  * @license
@@ -22606,9 +22633,6 @@ class ViewRef {
22606
22633
  /**
22607
22634
  * Marks a view and all of its ancestors dirty.
22608
22635
  *
22609
- * It also triggers change detection by calling `scheduleTick` internally, which coalesces
22610
- * multiple `markForCheck` calls to into one change detection run.
22611
- *
22612
22636
  * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
22613
22637
  * checked when it needs to be re-rendered but the two normal triggers haven't marked it
22614
22638
  * dirty (i.e. inputs haven't changed and events haven't fired in the view).