@angular-wave/angular.ts 0.4.1 → 0.4.3

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.
Files changed (90) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +2 -2
  3. package/package.json +7 -7
  4. package/src/angular.spec.js +1 -264
  5. package/src/animations/animate-css-driver.js +2 -2
  6. package/src/animations/animate-css.js +7 -8
  7. package/src/animations/animate-js-driver.js +1 -3
  8. package/src/animations/animate-js.js +4 -4
  9. package/src/animations/animate-queue.js +6 -6
  10. package/src/animations/animation.js +3 -3
  11. package/src/animations/shared.js +16 -14
  12. package/src/core/compile/attributes.js +2 -3
  13. package/src/core/compile/compile.js +248 -232
  14. package/src/core/compile/compile.spec.js +46 -51
  15. package/src/core/compile/compile.test.js +1 -1
  16. package/src/core/interpolate/interpolate.js +2 -2
  17. package/src/core/interval/interval.test.js +1 -1
  18. package/src/core/{parser/lexer.html → parse/ast/ast.html} +1 -1
  19. package/src/core/{parser → parse/ast}/ast.js +43 -29
  20. package/src/core/parse/ast/ast.spec.js +1462 -0
  21. package/src/core/parse/ast/ast.test.js +10 -0
  22. package/src/core/{parser → parse}/interpreter.js +10 -10
  23. package/src/core/parse/lexer/lexer.html +18 -0
  24. package/src/core/{parser → parse/lexer}/lexer.js +1 -1
  25. package/src/core/{parser → parse/lexer}/lexer.spec.js +2 -2
  26. package/src/core/parse/lexer/lexer.test.js +10 -0
  27. package/src/core/{parser → parse}/parse.html +1 -1
  28. package/src/core/{parser → parse}/parse.js +6 -6
  29. package/src/core/{parser → parse}/parse.spec.js +6 -1725
  30. package/src/core/parse/parse.test.js +10 -0
  31. package/src/core/parse/parser/parser.html +18 -0
  32. package/src/core/{parser → parse/parser}/parser.js +6 -6
  33. package/src/core/parse/parser/parser.spec.js +8 -0
  34. package/src/core/parse/parser/parser.test.js +10 -0
  35. package/src/core/sce/sce.js +1 -2
  36. package/src/core/scope/scope.js +4 -5
  37. package/src/directive/attrs/attrs.test.js +11 -0
  38. package/src/directive/attrs/boolean.html +18 -0
  39. package/src/directive/attrs/boolean.test.js +11 -0
  40. package/src/directive/attrs/element-style.html +21 -0
  41. package/src/directive/attrs/element-style.test.js +11 -0
  42. package/src/directive/bind/bing-html.spec.js +1 -1
  43. package/src/directive/class/class.js +1 -1
  44. package/src/directive/form/form.js +12 -19
  45. package/src/directive/if/if.spec.js +2 -3
  46. package/src/directive/if/if.test.js +1 -2
  47. package/src/directive/include/include.js +2 -2
  48. package/src/directive/input/input.js +1 -2
  49. package/src/directive/input/input.spec.js +187 -191
  50. package/src/directive/list/list.js +2 -2
  51. package/src/directive/model/model.js +14 -19
  52. package/src/directive/model-options/model-options.js +22 -26
  53. package/src/directive/options/options.js +1 -3
  54. package/src/directive/options/options.spec.js +3 -4
  55. package/src/directive/repeat/repeat.js +2 -2
  56. package/src/directive/repeat/repeat.spec.js +48 -57
  57. package/src/directive/select/select.spec.js +9 -10
  58. package/src/directive/switch/switch.js +1 -2
  59. package/src/directive/validators/validators.js +3 -3
  60. package/src/public.js +1 -1
  61. package/src/router/directives/state-directives.js +18 -16
  62. package/src/router/directives/view-directive.js +2 -2
  63. package/src/router/state/views.js +2 -2
  64. package/src/router/url/url-service.js +2 -8
  65. package/src/router/url/url-service.spec.js +3 -4
  66. package/src/services/http/http.js +5 -6
  67. package/src/services/http-backend/http-backend.js +19 -17
  68. package/src/shared/common.js +5 -8
  69. package/src/shared/jqlite/jqlite.js +14 -12
  70. package/src/shared/jqlite/jqlite.spec.js +2 -2
  71. package/src/shared/utils.js +15 -92
  72. package/types/animations/shared.d.ts +1 -1
  73. package/types/core/compile/compile.d.ts +1 -1
  74. package/types/core/interpolate/interpolate.d.ts +1 -1
  75. package/types/core/{parser → parse/ast}/ast.d.ts +17 -17
  76. package/types/core/{parser → parse}/interpreter.d.ts +7 -7
  77. package/types/core/{parser → parse/parser}/parser.d.ts +8 -8
  78. package/types/core/scope/scope.d.ts +3 -3
  79. package/types/directive/class/class.d.ts +3 -3
  80. package/types/directive/form/form.d.ts +1 -0
  81. package/types/directive/model/model.d.ts +6 -6
  82. package/types/directive/validators/validators.d.ts +3 -3
  83. package/types/shared/common.d.ts +0 -1
  84. package/types/shared/utils.d.ts +0 -35
  85. package/src/core/parser/parser.test.js +0 -19
  86. /package/src/core/{parser → parse}/ast-type.js +0 -0
  87. /package/src/core/{parser → parse}/parse.md +0 -0
  88. /package/types/core/{parser → parse}/ast-type.d.ts +0 -0
  89. /package/types/core/{parser → parse/lexer}/lexer.d.ts +0 -0
  90. /package/types/core/{parser → parse}/parse.d.ts +0 -0
@@ -12,7 +12,6 @@ import {
12
12
  minErr,
13
13
  assertArg,
14
14
  assertNotHasOwnProperty,
15
- forEach,
16
15
  isDefined,
17
16
  isFunction,
18
17
  isObject,
@@ -74,7 +73,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
74
73
 
75
74
  const bindings = Object.create(null);
76
75
 
77
- forEach(scope, (definition, scopeName) => {
76
+ Object.entries(scope).forEach(([scopeName, definition]) => {
78
77
  definition = definition.trim();
79
78
 
80
79
  if (definition in bindingCache) {
@@ -337,7 +336,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
337
336
 
338
337
  // Copy any annotation properties (starting with $) over to the factory and controller constructor functions
339
338
  // These could be used by libraries such as the new component router
340
- forEach(options, (val, key) => {
339
+ Object.entries(options).forEach(([key, val]) => {
341
340
  if (key.charAt(0) === "$") {
342
341
  factory[key] = val;
343
342
  // Don't try to copy over annotations to named controller
@@ -528,7 +527,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
528
527
  * @param {*} $interpolate
529
528
  * @param {import("../exception-handler").ErrorHandler} $exceptionHandler
530
529
  * @param {*} $templateRequest
531
- * @param {import("../parser/parse").ParseService} $parse
530
+ * @param {import("../parse/parse").ParseService} $parse
532
531
  * @param {*} $controller
533
532
  * @param {import('../scope/scope').Scope} $rootScope
534
533
  * @param {*} $sce
@@ -1352,51 +1351,57 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
1352
1351
  }
1353
1352
 
1354
1353
  // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
1355
- forEach(controllerDirectives, (controllerDirective, name) => {
1356
- const { require } = controllerDirective;
1357
- if (
1358
- controllerDirective.bindToController &&
1359
- !Array.isArray(require) &&
1360
- isObject(require)
1361
- ) {
1362
- extend(
1363
- elementControllers[name].instance,
1364
- getControllers(name, require, $element, elementControllers),
1365
- );
1366
- }
1367
- });
1354
+ if (controllerDirectives) {
1355
+ Object.entries(controllerDirectives).forEach(
1356
+ ([name, controllerDirective]) => {
1357
+ const { require } = controllerDirective;
1358
+ if (
1359
+ controllerDirective.bindToController &&
1360
+ !Array.isArray(require) &&
1361
+ isObject(require)
1362
+ ) {
1363
+ extend(
1364
+ elementControllers[name].instance,
1365
+ getControllers(name, require, $element, elementControllers),
1366
+ );
1367
+ }
1368
+ },
1369
+ );
1370
+ }
1368
1371
 
1369
1372
  // Handle the init and destroy lifecycle hooks on all controllers that have them
1370
- forEach(elementControllers, (controller) => {
1371
- const controllerInstance = controller.instance;
1372
- if (isFunction(controllerInstance.$onChanges)) {
1373
- try {
1374
- controllerInstance.$onChanges(
1375
- controller.bindingInfo.initialChanges,
1376
- );
1377
- } catch (e) {
1378
- $exceptionHandler(e);
1373
+ if (elementControllers) {
1374
+ Object.values(elementControllers).forEach((controller) => {
1375
+ const controllerInstance = controller.instance;
1376
+ if (isFunction(controllerInstance.$onChanges)) {
1377
+ try {
1378
+ controllerInstance.$onChanges(
1379
+ controller.bindingInfo.initialChanges,
1380
+ );
1381
+ } catch (e) {
1382
+ $exceptionHandler(e);
1383
+ }
1379
1384
  }
1380
- }
1381
- if (isFunction(controllerInstance.$onInit)) {
1382
- try {
1383
- controllerInstance.$onInit();
1384
- } catch (e) {
1385
- $exceptionHandler(e);
1385
+ if (isFunction(controllerInstance.$onInit)) {
1386
+ try {
1387
+ controllerInstance.$onInit();
1388
+ } catch (e) {
1389
+ $exceptionHandler(e);
1390
+ }
1386
1391
  }
1387
- }
1388
- if (isFunction(controllerInstance.$doCheck)) {
1389
- controllerScope.$watch(() => {
1392
+ if (isFunction(controllerInstance.$doCheck)) {
1393
+ controllerScope.$watch(() => {
1394
+ controllerInstance.$doCheck();
1395
+ });
1390
1396
  controllerInstance.$doCheck();
1391
- });
1392
- controllerInstance.$doCheck();
1393
- }
1394
- if (isFunction(controllerInstance.$onDestroy)) {
1395
- controllerScope.$on("$destroy", () => {
1396
- controllerInstance.$onDestroy();
1397
- });
1398
- }
1399
- });
1397
+ }
1398
+ if (isFunction(controllerInstance.$onDestroy)) {
1399
+ controllerScope.$on("$destroy", () => {
1400
+ controllerInstance.$onDestroy();
1401
+ });
1402
+ }
1403
+ });
1404
+ }
1400
1405
 
1401
1406
  // PRELINKING
1402
1407
  for (i = 0, ii = preLinkFns.length; i < ii; i++) {
@@ -1456,13 +1461,15 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
1456
1461
  );
1457
1462
  }
1458
1463
 
1459
- // Trigger $postLink lifecycle hooks
1460
- forEach(elementControllers, (controller) => {
1461
- const controllerInstance = controller.instance;
1462
- if (isFunction(controllerInstance.$postLink)) {
1463
- controllerInstance.$postLink();
1464
- }
1465
- });
1464
+ if (elementControllers) {
1465
+ // Trigger $postLink lifecycle hooks
1466
+ Object.values(elementControllers).forEach((controller) => {
1467
+ const controllerInstance = controller.instance;
1468
+ if (isFunction(controllerInstance.$postLink)) {
1469
+ controllerInstance.$postLink();
1470
+ }
1471
+ });
1472
+ }
1466
1473
 
1467
1474
  // This is the function that is injected as `$transclude`.
1468
1475
  // Note: all arguments are optional!
@@ -1683,42 +1690,45 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
1683
1690
  const filledSlots = Object.create(null);
1684
1691
 
1685
1692
  // Parse the element selectors
1686
- forEach(directiveValue, (elementSelector, slotName) => {
1687
- // If an element selector starts with a ? then it is optional
1688
- const optional = elementSelector.charAt(0) === "?";
1689
- elementSelector = optional
1690
- ? elementSelector.substring(1)
1691
- : elementSelector;
1692
-
1693
- slotMap[elementSelector] = slotName;
1694
-
1695
- // We explicitly assign `null` since this implies that a slot was defined but not filled.
1696
- // Later when calling boundTransclusion functions with a slot name we only error if the
1697
- // slot is `undefined`
1698
- slots[slotName] = null;
1699
-
1700
- // filledSlots contains `true` for all slots that are either optional or have been
1701
- // filled. This is used to check that we have not missed any required slots
1702
- filledSlots[slotName] = optional;
1703
- });
1693
+ Object.entries(directiveValue).forEach(
1694
+ ([slotName, elementSelector]) => {
1695
+ // If an element selector starts with a ? then it is optional
1696
+ const optional = elementSelector.charAt(0) === "?";
1697
+ elementSelector = optional
1698
+ ? elementSelector.substring(1)
1699
+ : elementSelector;
1700
+
1701
+ slotMap[elementSelector] = slotName;
1702
+
1703
+ // We explicitly assign `null` since this implies that a slot was defined but not filled.
1704
+ // Later when calling boundTransclusion functions with a slot name we only error if the
1705
+ // slot is `undefined`
1706
+ slots[slotName] = null;
1707
+
1708
+ // filledSlots contains `true` for all slots that are either optional or have been
1709
+ // filled. This is used to check that we have not missed any required slots
1710
+ filledSlots[slotName] = optional;
1711
+ },
1712
+ );
1704
1713
 
1705
1714
  // Add the matching elements into their slot
1706
-
1707
- forEach(JQLite($compileNode[0].childNodes), (node) => {
1708
- const slotName =
1709
- slotMap[directiveNormalize(getNodeName(node))];
1710
- if (slotName) {
1711
- filledSlots[slotName] = true;
1712
- slots[slotName] =
1713
- slots[slotName] || document.createDocumentFragment();
1714
- slots[slotName].appendChild(node);
1715
- } else {
1716
- $template.appendChild(node);
1717
- }
1718
- });
1715
+ JQLite($compileNode[0].childNodes)
1716
+ .elements()
1717
+ .forEach((node) => {
1718
+ const slotName =
1719
+ slotMap[directiveNormalize(getNodeName(node))];
1720
+ if (slotName) {
1721
+ filledSlots[slotName] = true;
1722
+ slots[slotName] =
1723
+ slots[slotName] || document.createDocumentFragment();
1724
+ slots[slotName].appendChild(node);
1725
+ } else {
1726
+ $template.appendChild(node);
1727
+ }
1728
+ });
1719
1729
 
1720
1730
  // Check for required slots that were not filled
1721
- forEach(filledSlots, (filled, slotName) => {
1731
+ Object.entries(filledSlots).forEach(([slotName, filled]) => {
1722
1732
  if (!filled) {
1723
1733
  throw $compileMinErr(
1724
1734
  "reqslot",
@@ -2009,7 +2019,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
2009
2019
  }
2010
2020
  } else if (isObject(require)) {
2011
2021
  value = {};
2012
- forEach(require, (controller, property) => {
2022
+ Object.entries(require).forEach(([property, controller]) => {
2013
2023
  value[property] = getControllers(
2014
2024
  directiveName,
2015
2025
  controller,
@@ -2184,7 +2194,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
2184
2194
  const dstAttr = dst.$attr;
2185
2195
 
2186
2196
  // reapply the old attributes to the new element
2187
- forEach(dst, (value, key) => {
2197
+ Object.entries(dst).forEach(([key, value]) => {
2188
2198
  if (key.charAt(0) !== "$") {
2189
2199
  if (src[key] && src[key] !== value) {
2190
2200
  if (value.length) {
@@ -2198,7 +2208,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
2198
2208
  });
2199
2209
 
2200
2210
  // copy the new attributes on the old attrs object
2201
- forEach(src, (value, key) => {
2211
+ Object.entries(src).forEach(([key, value]) => {
2202
2212
  // Check if we already set this attribute in the loop above.
2203
2213
  // `dst` will never contain hasOwnProperty as DOM parser won't let it.
2204
2214
  // You will get an "InvalidCharacterError: DOM Exception 5" error if you
@@ -2309,11 +2319,13 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
2309
2319
  postLinkFns,
2310
2320
  previousCompileContext,
2311
2321
  );
2312
- forEach($rootElement, (node, i) => {
2313
- if (node === compileNode) {
2314
- $rootElement[i] = $compileNode[0];
2315
- }
2316
- });
2322
+ if ($rootElement) {
2323
+ Object.entries($rootElement).forEach(([i, node]) => {
2324
+ if (node === compileNode) {
2325
+ $rootElement[i] = $compileNode[0];
2326
+ }
2327
+ });
2328
+ }
2317
2329
  afterTemplateChildLinkFn = compileNodes(
2318
2330
  $compileNode[0].childNodes,
2319
2331
  childTranscludeFn,
@@ -2856,161 +2868,165 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
2856
2868
  const initialChanges = {};
2857
2869
  let changes;
2858
2870
 
2859
- forEach(bindings, (definition, scopeName) => {
2860
- const { attrName } = definition;
2861
- const { optional } = definition;
2862
- const { mode } = definition; // @, =, <, or &
2863
- let lastValue;
2864
- let parentGet;
2865
- let parentSet;
2866
- let compare;
2867
- let removeWatch;
2868
-
2869
- switch (mode) {
2870
- case "@":
2871
- if (!optional && !Object.hasOwnProperty.call(attrs, attrName)) {
2872
- strictBindingsCheck(attrName, directive.name);
2873
- destination[scopeName] = attrs[attrName] = undefined;
2874
- }
2875
- removeWatch = attrs.$observe(attrName, (value) => {
2876
- if (isString(value) || isBoolean(value)) {
2877
- const oldValue = destination[scopeName];
2878
- recordChanges(scopeName, value, oldValue);
2879
- destination[scopeName] = value;
2871
+ if (bindings) {
2872
+ Object.entries(bindings).forEach(([scopeName, definition]) => {
2873
+ const { attrName } = definition;
2874
+ const { optional } = definition;
2875
+ const { mode } = definition; // @, =, <, or &
2876
+ let lastValue;
2877
+ let parentGet;
2878
+ let parentSet;
2879
+ let compare;
2880
+ let removeWatch;
2881
+
2882
+ switch (mode) {
2883
+ case "@":
2884
+ if (!optional && !Object.hasOwnProperty.call(attrs, attrName)) {
2885
+ strictBindingsCheck(attrName, directive.name);
2886
+ destination[scopeName] = attrs[attrName] = undefined;
2880
2887
  }
2881
- });
2882
- attrs.$$observers[attrName].$$scope = scope;
2883
- lastValue = attrs[attrName];
2884
- if (isString(lastValue)) {
2885
- // If the attribute has been provided then we trigger an interpolation to ensure
2886
- // the value is there for use in the link fn
2887
- destination[scopeName] = $interpolate(lastValue)(scope);
2888
- } else if (isBoolean(lastValue)) {
2889
- // If the attributes is one of the BOOLEAN_ATTR then AngularJS will have converted
2890
- // the value to boolean rather than a string, so we special case this situation
2891
- destination[scopeName] = lastValue;
2892
- }
2893
- initialChanges[scopeName] = new SimpleChange(
2894
- UNINITALIZED_VALIED,
2895
- destination[scopeName],
2896
- );
2897
- removeWatchCollection.push(removeWatch);
2898
- break;
2888
+ removeWatch = attrs.$observe(attrName, (value) => {
2889
+ if (isString(value) || isBoolean(value)) {
2890
+ const oldValue = destination[scopeName];
2891
+ recordChanges(scopeName, value, oldValue);
2892
+ destination[scopeName] = value;
2893
+ }
2894
+ });
2895
+ attrs.$$observers[attrName].$$scope = scope;
2896
+ lastValue = attrs[attrName];
2897
+ if (isString(lastValue)) {
2898
+ // If the attribute has been provided then we trigger an interpolation to ensure
2899
+ // the value is there for use in the link fn
2900
+ destination[scopeName] = $interpolate(lastValue)(scope);
2901
+ } else if (isBoolean(lastValue)) {
2902
+ // If the attributes is one of the BOOLEAN_ATTR then AngularJS will have converted
2903
+ // the value to boolean rather than a string, so we special case this situation
2904
+ destination[scopeName] = lastValue;
2905
+ }
2906
+ initialChanges[scopeName] = new SimpleChange(
2907
+ UNINITALIZED_VALIED,
2908
+ destination[scopeName],
2909
+ );
2910
+ removeWatchCollection.push(removeWatch);
2911
+ break;
2899
2912
 
2900
- case "=":
2901
- if (!Object.hasOwnProperty.call(attrs, attrName)) {
2902
- if (optional) break;
2903
- strictBindingsCheck(attrName, directive.name);
2904
- attrs[attrName] = undefined;
2905
- }
2906
- if (optional && !attrs[attrName]) break;
2913
+ case "=":
2914
+ if (!Object.hasOwnProperty.call(attrs, attrName)) {
2915
+ if (optional) break;
2916
+ strictBindingsCheck(attrName, directive.name);
2917
+ attrs[attrName] = undefined;
2918
+ }
2919
+ if (optional && !attrs[attrName]) break;
2907
2920
 
2908
- parentGet = $parse(attrs[attrName]);
2909
- if (parentGet.literal) {
2910
- compare = equals;
2911
- } else {
2912
- compare = simpleCompare;
2913
- }
2914
- parentSet =
2915
- parentGet.assign ||
2916
- function () {
2917
- // reset the change, or we will throw this exception on every $digest
2918
- lastValue = destination[scopeName] = parentGet(scope);
2919
- throw $compileMinErr(
2920
- "nonassign",
2921
- "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
2921
+ parentGet = $parse(attrs[attrName]);
2922
+ if (parentGet.literal) {
2923
+ compare = equals;
2924
+ } else {
2925
+ compare = simpleCompare;
2926
+ }
2927
+ parentSet =
2928
+ parentGet.assign ||
2929
+ function () {
2930
+ // reset the change, or we will throw this exception on every $digest
2931
+ lastValue = destination[scopeName] = parentGet(scope);
2932
+ throw $compileMinErr(
2933
+ "nonassign",
2934
+ "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
2935
+ attrs[attrName],
2936
+ attrName,
2937
+ directive.name,
2938
+ );
2939
+ };
2940
+ lastValue = destination[scopeName] = parentGet(scope);
2941
+ var parentValueWatch = function parentValueWatch(parentValue) {
2942
+ if (!compare(parentValue, destination[scopeName])) {
2943
+ // we are out of sync and need to copy
2944
+ if (!compare(parentValue, lastValue)) {
2945
+ // parent changed and it has precedence
2946
+ destination[scopeName] = parentValue;
2947
+ } else {
2948
+ // if the parent can be assigned then do so
2949
+ parentSet(scope, (parentValue = destination[scopeName]));
2950
+ }
2951
+ }
2952
+ lastValue = parentValue;
2953
+ return lastValue;
2954
+ };
2955
+ parentValueWatch.$stateful = true;
2956
+ if (definition.collection) {
2957
+ removeWatch = scope.$watchCollection(
2922
2958
  attrs[attrName],
2923
- attrName,
2924
- directive.name,
2959
+ parentValueWatch,
2960
+ );
2961
+ } else {
2962
+ removeWatch = scope.$watch(
2963
+ $parse(attrs[attrName], parentValueWatch),
2964
+ null,
2965
+ parentGet.literal,
2925
2966
  );
2926
- };
2927
- lastValue = destination[scopeName] = parentGet(scope);
2928
- var parentValueWatch = function parentValueWatch(parentValue) {
2929
- if (!compare(parentValue, destination[scopeName])) {
2930
- // we are out of sync and need to copy
2931
- if (!compare(parentValue, lastValue)) {
2932
- // parent changed and it has precedence
2933
- destination[scopeName] = parentValue;
2934
- } else {
2935
- // if the parent can be assigned then do so
2936
- parentSet(scope, (parentValue = destination[scopeName]));
2937
- }
2938
2967
  }
2939
- lastValue = parentValue;
2940
- return lastValue;
2941
- };
2942
- parentValueWatch.$stateful = true;
2943
- if (definition.collection) {
2944
- removeWatch = scope.$watchCollection(
2945
- attrs[attrName],
2946
- parentValueWatch,
2947
- );
2948
- } else {
2949
- removeWatch = scope.$watch(
2950
- $parse(attrs[attrName], parentValueWatch),
2951
- null,
2952
- parentGet.literal,
2953
- );
2954
- }
2955
- removeWatchCollection.push(removeWatch);
2956
- break;
2968
+ removeWatchCollection.push(removeWatch);
2969
+ break;
2957
2970
 
2958
- case "<":
2959
- if (!Object.hasOwnProperty.call(attrs, attrName)) {
2960
- if (optional) break;
2961
- strictBindingsCheck(attrName, directive.name);
2962
- attrs[attrName] = undefined;
2963
- }
2964
- if (optional && !attrs[attrName]) break;
2971
+ case "<":
2972
+ if (!Object.hasOwnProperty.call(attrs, attrName)) {
2973
+ if (optional) break;
2974
+ strictBindingsCheck(attrName, directive.name);
2975
+ attrs[attrName] = undefined;
2976
+ }
2977
+ if (optional && !attrs[attrName]) break;
2965
2978
 
2966
- parentGet = $parse(attrs[attrName]);
2967
- var isLiteral = parentGet.literal;
2979
+ parentGet = $parse(attrs[attrName]);
2980
+ var isLiteral = parentGet.literal;
2968
2981
 
2969
- var initialValue = (destination[scopeName] = parentGet(scope));
2970
- initialChanges[scopeName] = new SimpleChange(
2971
- UNINITALIZED_VALIED,
2972
- destination[scopeName],
2973
- );
2982
+ var initialValue = (destination[scopeName] = parentGet(scope));
2983
+ initialChanges[scopeName] = new SimpleChange(
2984
+ UNINITALIZED_VALIED,
2985
+ destination[scopeName],
2986
+ );
2974
2987
 
2975
- removeWatch = scope[
2976
- definition.collection ? "$watchCollection" : "$watch"
2977
- ](parentGet, (newValue, oldValue) => {
2978
- if (oldValue === newValue) {
2979
- if (
2980
- oldValue === initialValue ||
2981
- (isLiteral && equals(oldValue, initialValue))
2982
- ) {
2983
- return;
2988
+ removeWatch = scope[
2989
+ definition.collection ? "$watchCollection" : "$watch"
2990
+ ](parentGet, (newValue, oldValue) => {
2991
+ if (oldValue === newValue) {
2992
+ if (
2993
+ oldValue === initialValue ||
2994
+ (isLiteral && equals(oldValue, initialValue))
2995
+ ) {
2996
+ return;
2997
+ }
2998
+ oldValue = initialValue;
2984
2999
  }
2985
- oldValue = initialValue;
2986
- }
2987
- recordChanges(scopeName, newValue, oldValue);
2988
- destination[scopeName] = newValue;
2989
- });
2990
-
2991
- removeWatchCollection.push(removeWatch);
2992
- break;
2993
-
2994
- case "&":
2995
- if (!optional && !Object.hasOwnProperty.call(attrs, attrName)) {
2996
- strictBindingsCheck(attrName, directive.name);
2997
- }
2998
- // Don't assign Object.prototype method to scope
2999
- parentGet = Object.prototype.hasOwnProperty.call(attrs, attrName)
3000
- ? $parse(attrs[attrName])
3001
- : () => {};
3000
+ recordChanges(scopeName, newValue, oldValue);
3001
+ destination[scopeName] = newValue;
3002
+ });
3002
3003
 
3003
- // Don't assign noop to destination if expression is not valid
3004
- if (parentGet.toString() === (() => {}).toString() && optional)
3004
+ removeWatchCollection.push(removeWatch);
3005
3005
  break;
3006
3006
 
3007
- destination[scopeName] = function (locals) {
3008
- return parentGet(scope, locals);
3009
- };
3010
- break;
3011
- }
3012
- });
3013
-
3007
+ case "&":
3008
+ if (!optional && !Object.hasOwnProperty.call(attrs, attrName)) {
3009
+ strictBindingsCheck(attrName, directive.name);
3010
+ }
3011
+ // Don't assign Object.prototype method to scope
3012
+ parentGet = Object.prototype.hasOwnProperty.call(
3013
+ attrs,
3014
+ attrName,
3015
+ )
3016
+ ? $parse(attrs[attrName])
3017
+ : () => {};
3018
+
3019
+ // Don't assign noop to destination if expression is not valid
3020
+ if (parentGet.toString() === (() => {}).toString() && optional)
3021
+ break;
3022
+
3023
+ destination[scopeName] = function (locals) {
3024
+ return parentGet(scope, locals);
3025
+ };
3026
+ break;
3027
+ }
3028
+ });
3029
+ }
3014
3030
  function recordChanges(key, currentValue, previousValue) {
3015
3031
  if (
3016
3032
  isFunction(destination.$onChanges) &&