@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.
@@ -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
  */
@@ -20702,7 +20702,7 @@
20702
20702
  var hasBinding = text.match(BINDING_REGEXP);
20703
20703
  var tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
20704
20704
  if (hasBinding) {
20705
- generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index);
20705
+ generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index, null, 0, null);
20706
20706
  }
20707
20707
  }
20708
20708
  /**
@@ -20730,7 +20730,9 @@
20730
20730
  }
20731
20731
  // i18n attributes that hit this code path are guaranteed to have bindings, because
20732
20732
  // the compiler treats static i18n attributes as regular attribute bindings.
20733
- generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName);
20733
+ // Since this may not be the first i18n attribute on this element we need to pass in how
20734
+ // many previous bindings there have already been.
20735
+ generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
20734
20736
  }
20735
20737
  }
20736
20738
  tView.data[index] = updateOpCodes;
@@ -20744,9 +20746,10 @@
20744
20746
  * @param destinationNode Index of the destination node which will receive the binding.
20745
20747
  * @param attrName Name of the attribute, if the string belongs to an attribute.
20746
20748
  * @param sanitizeFn Sanitization function used to sanitize the string after update, if necessary.
20749
+ * @param bindingStart The lView index of the next expression that can be bound via an opCode.
20750
+ * @returns The mask value for these bindings
20747
20751
  */
20748
- function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, sanitizeFn) {
20749
- if (sanitizeFn === void 0) { sanitizeFn = null; }
20752
+ function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
20750
20753
  ngDevMode &&
20751
20754
  assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, 'Index must be in absolute LView offset');
20752
20755
  var maskIndex = updateOpCodes.length; // Location of mask
@@ -20762,7 +20765,7 @@
20762
20765
  var textValue = textParts[j];
20763
20766
  if (j & 1) {
20764
20767
  // Odd indexes are bindings
20765
- var bindingIndex = parseInt(textValue, 10);
20768
+ var bindingIndex = bindingStart + parseInt(textValue, 10);
20766
20769
  updateOpCodes.push(-1 - bindingIndex);
20767
20770
  mask = mask | toMaskBit(bindingIndex);
20768
20771
  }
@@ -20780,6 +20783,28 @@
20780
20783
  updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
20781
20784
  return mask;
20782
20785
  }
20786
+ /**
20787
+ * Count the number of bindings in the given `opCodes`.
20788
+ *
20789
+ * It could be possible to speed this up, by passing the number of bindings found back from
20790
+ * `generateBindingUpdateOpCodes()` to `i18nAttributesFirstPass()` but this would then require more
20791
+ * complexity in the code and/or transient objects to be created.
20792
+ *
20793
+ * Since this function is only called once when the template is instantiated, is trivial in the
20794
+ * first instance (since `opCodes` will be an empty array), and it is not common for elements to
20795
+ * contain multiple i18n bound attributes, it seems like this is a reasonable compromise.
20796
+ */
20797
+ function countBindings(opCodes) {
20798
+ var count = 0;
20799
+ for (var i = 0; i < opCodes.length; i++) {
20800
+ var opCode = opCodes[i];
20801
+ // Bindings are negative numbers.
20802
+ if (typeof opCode === 'number' && opCode < 0) {
20803
+ count++;
20804
+ }
20805
+ }
20806
+ return count;
20807
+ }
20783
20808
  /**
20784
20809
  * Convert binding index to mask bit.
20785
20810
  *
@@ -21031,13 +21056,13 @@
21031
21056
  if (hasBinding_1) {
21032
21057
  if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
21033
21058
  if (URI_ATTRS[lowerAttrName]) {
21034
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, _sanitizeUrl);
21059
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
21035
21060
  }
21036
21061
  else if (SRCSET_ATTRS[lowerAttrName]) {
21037
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, sanitizeSrcset);
21062
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, sanitizeSrcset);
21038
21063
  }
21039
21064
  else {
21040
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name);
21065
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
21041
21066
  }
21042
21067
  }
21043
21068
  else {
@@ -21063,7 +21088,8 @@
21063
21088
  addCreateNodeAndAppend(create, null, hasBinding ? '' : value, parentIdx, newIndex);
21064
21089
  addRemoveNode(remove, newIndex, depth);
21065
21090
  if (hasBinding) {
21066
- bindingMask = generateBindingUpdateOpCodes(update, value, newIndex) | bindingMask;
21091
+ bindingMask =
21092
+ generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
21067
21093
  }
21068
21094
  break;
21069
21095
  case Node.COMMENT_NODE:
@@ -21983,7 +22009,7 @@
21983
22009
  /**
21984
22010
  * @publicApi
21985
22011
  */
21986
- var VERSION = new Version('11.2.12');
22012
+ var VERSION = new Version('11.2.13');
21987
22013
 
21988
22014
  /**
21989
22015
  * @license
@@ -23195,9 +23221,6 @@
23195
23221
  /**
23196
23222
  * Marks a view and all of its ancestors dirty.
23197
23223
  *
23198
- * It also triggers change detection by calling `scheduleTick` internally, which coalesces
23199
- * multiple `markForCheck` calls to into one change detection run.
23200
- *
23201
23224
  * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
23202
23225
  * checked when it needs to be re-rendered but the two normal triggers haven't marked it
23203
23226
  * dirty (i.e. inputs haven't changed and events haven't fired in the view).