@angular-wave/angular.ts 0.4.2 → 0.4.4

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 (150) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +12 -2
  3. package/index.html +74 -3
  4. package/package.json +7 -7
  5. package/src/angular.spec.js +1 -269
  6. package/src/animations/animate-css-driver.js +2 -2
  7. package/src/animations/animate-css.js +12 -21
  8. package/src/animations/animate-js-driver.js +1 -3
  9. package/src/animations/animate-js.js +4 -4
  10. package/src/animations/animate-queue.js +23 -23
  11. package/src/animations/animate-runner.js +4 -8
  12. package/src/animations/animate.md +1 -1
  13. package/src/animations/animate.spec.js +0 -21
  14. package/src/animations/animation.js +4 -4
  15. package/src/animations/shared.js +14 -12
  16. package/src/binding.spec.js +0 -1
  17. package/src/core/cache/cache.js +2 -29
  18. package/src/core/compile/attributes.js +2 -3
  19. package/src/core/compile/compile.js +260 -245
  20. package/src/core/compile/compile.spec.js +63 -317
  21. package/src/core/compile/compile.test.js +1 -1
  22. package/src/core/controller/controller.js +2 -0
  23. package/src/core/di/injector.md +1 -1
  24. package/src/core/di/injector.spec.js +0 -2
  25. package/src/core/di/internal-injector.js +2 -1
  26. package/src/core/interpolate/interpolate.js +16 -3
  27. package/src/core/interpolate/interpolate.spec.js +70 -16
  28. package/src/core/location/location.js +0 -2
  29. package/src/core/location/location.spec.js +27 -27
  30. package/src/core/{scope/scope.html → model/model.html} +1 -1
  31. package/src/core/model/model.js +944 -0
  32. package/src/core/model/model.spec.js +3012 -0
  33. package/src/core/on.spec.js +0 -7
  34. package/src/core/parse/interpreter.js +10 -7
  35. package/src/core/parse/parse.js +28 -7
  36. package/src/core/parse/parse.spec.js +95 -91
  37. package/src/core/prop.spec.js +4 -60
  38. package/src/core/sce/sce.js +1 -2
  39. package/src/core/sce/sce.spec.js +0 -8
  40. package/src/core/scope/scope.js +62 -32
  41. package/src/core/scope/scope.spec.js +25 -1960
  42. package/src/directive/aria/aria.js +3 -6
  43. package/src/directive/aria/aria.spec.js +0 -87
  44. package/src/directive/attrs/attrs.spec.js +0 -5
  45. package/src/directive/{list/list.test.js → attrs/attrs.test.js} +1 -1
  46. package/src/{core/q/q.html → directive/attrs/boolean.html} +1 -1
  47. package/src/directive/attrs/boolean.spec.js +0 -15
  48. package/src/{core/q/q.test.js → directive/attrs/boolean.test.js} +1 -2
  49. package/src/{core/timeout/timeout.html → directive/attrs/element-style.html} +4 -1
  50. package/src/directive/attrs/element-style.spec.js +0 -8
  51. package/src/{core/scope/scope.test.js → directive/attrs/element-style.test.js} +1 -2
  52. package/src/directive/attrs/src.spec.js +0 -7
  53. package/src/directive/bind/bind.spec.js +0 -33
  54. package/src/directive/bind/bing-html.spec.js +1 -4
  55. package/src/{core/interval/interval.html → directive/channel/channel.html} +1 -1
  56. package/src/directive/channel/channel.js +29 -0
  57. package/src/directive/channel/channel.spec.js +52 -0
  58. package/src/directive/channel/channel.test.js +9 -0
  59. package/src/directive/class/class.js +3 -3
  60. package/src/directive/class/class.spec.js +9 -75
  61. package/src/directive/controller/controller.spec.js +0 -13
  62. package/src/directive/events/click.spec.js +0 -3
  63. package/src/directive/events/event.spec.js +0 -6
  64. package/src/directive/form/form.js +14 -22
  65. package/src/directive/form/form.spec.js +0 -65
  66. package/src/directive/if/if.spec.js +2 -7
  67. package/src/directive/if/if.test.js +1 -2
  68. package/src/directive/include/include.js +2 -2
  69. package/src/directive/include/include.spec.js +8 -59
  70. package/src/directive/init/init.js +6 -2
  71. package/src/directive/init/init.spec.js +0 -2
  72. package/src/directive/input/input.js +1 -2
  73. package/src/directive/input/input.spec.js +191 -331
  74. package/src/directive/messages/messages.spec.js +4 -35
  75. package/src/directive/model/model.js +30 -42
  76. package/src/directive/model/model.spec.js +2 -49
  77. package/src/directive/model-options/model-options.js +22 -26
  78. package/src/directive/model-options/model-options.spec.js +0 -6
  79. package/src/directive/non-bindable/non-bindable.spec.js +0 -1
  80. package/src/directive/observe/observe.js +0 -1
  81. package/src/directive/observe/observe.spec.js +0 -1
  82. package/src/directive/options/options.js +1 -3
  83. package/src/directive/options/options.spec.js +3 -38
  84. package/src/directive/ref/href.spec.js +0 -15
  85. package/src/directive/repeat/repeat.js +2 -2
  86. package/src/directive/repeat/repeat.spec.js +56 -192
  87. package/src/directive/script/script.spec.js +0 -2
  88. package/src/directive/select/select.js +3 -3
  89. package/src/directive/select/select.spec.js +9 -106
  90. package/src/directive/show-hide/show-hide.js +2 -2
  91. package/src/directive/show-hide/show-hide.spec.js +8 -19
  92. package/src/directive/style/style.spec.js +0 -7
  93. package/src/directive/switch/switch.js +1 -2
  94. package/src/directive/switch/switch.spec.js +5 -5
  95. package/src/directive/validators/validators.spec.js +0 -1
  96. package/src/loader.js +0 -1
  97. package/src/public.js +75 -80
  98. package/src/router/common/coreservices.js +0 -2
  99. package/src/router/directives/state-directives.js +24 -30
  100. package/src/router/directives/state-directives.spec.js +0 -83
  101. package/src/router/directives/view-directive.js +6 -15
  102. package/src/router/directives/view-directive.spec.js +25 -71
  103. package/src/router/hooks/lazy-load.js +2 -2
  104. package/src/router/hooks/views.js +3 -5
  105. package/src/router/resolve/resolvable.js +3 -6
  106. package/src/router/resolve/resolve-context.js +2 -2
  107. package/src/router/state/state-service.js +4 -4
  108. package/src/router/state/state.spec.js +2 -5
  109. package/src/router/state/views.js +9 -12
  110. package/src/router/template-factory.js +3 -6
  111. package/src/router/template-factory.spec.js +0 -4
  112. package/src/router/transition/transition-hook.js +1 -1
  113. package/src/router/transition/transition.js +1 -1
  114. package/src/router/url/url-service.js +2 -8
  115. package/src/router/url/url-service.spec.js +3 -4
  116. package/src/router/view-hook.spec.js +2 -2
  117. package/src/router/view-scroll.js +4 -6
  118. package/src/services/http/http.js +11 -15
  119. package/src/services/http/http.spec.js +30 -31
  120. package/src/services/http/template-request.spec.js +0 -10
  121. package/src/services/http-backend/http-backend.js +19 -17
  122. package/src/services/http-backend/http-backend.spec.js +3 -3
  123. package/src/services/template-request.js +2 -4
  124. package/src/shared/common.js +6 -10
  125. package/src/shared/jqlite/jqlite.js +14 -15
  126. package/src/shared/jqlite/jqlite.spec.js +2 -2
  127. package/src/shared/utils.js +15 -92
  128. package/types/core/cache/cache.d.ts +1 -1
  129. package/types/core/model/model.d.ts +204 -0
  130. package/types/core/parse/parse.d.ts +26 -0
  131. package/types/core/scope/scope.d.ts +22 -21
  132. package/types/directive/channel/channel.d.ts +11 -0
  133. package/types/directive/form/form.d.ts +1 -0
  134. package/types/shared/common.d.ts +0 -1
  135. package/types/shared/utils.d.ts +0 -35
  136. package/src/core/interval/interval-factory.js +0 -50
  137. package/src/core/interval/interval.js +0 -77
  138. package/src/core/interval/interval.md +0 -123
  139. package/src/core/interval/interval.spec.js +0 -280
  140. package/src/core/q/q.js +0 -472
  141. package/src/core/q/q.md +0 -211
  142. package/src/core/q/q.spec.js +0 -2748
  143. package/src/core/timeout/timeout.js +0 -109
  144. package/src/core/timeout/timeout.spec.js +0 -354
  145. package/src/core/timeout/timout.test.js +0 -12
  146. package/src/directive/list/list.html +0 -18
  147. package/src/directive/list/list.js +0 -46
  148. package/src/directive/list/list.md +0 -22
  149. package/src/directive/list/list.spec.js +0 -172
  150. package/types/directive/list/list.d.ts +0 -4
@@ -34,13 +34,10 @@ fdescribe("ngProp*", () => {
34
34
  const element = $compile(
35
35
  '<button ng-prop-disabled="isDisabled">Button</button>',
36
36
  )($rootScope);
37
- $rootScope.$digest();
38
37
  expect(element[0].disabled).toBe(false);
39
38
  $rootScope.isDisabled = true;
40
- $rootScope.$digest();
41
39
  expect(element[0].disabled).toBe(true);
42
40
  $rootScope.isDisabled = false;
43
- $rootScope.$digest();
44
41
  expect(element[0].disabled).toBe(false);
45
42
  });
46
43
 
@@ -50,33 +47,26 @@ fdescribe("ngProp*", () => {
50
47
  )($rootScope);
51
48
  expect(element[0].checked).toBe(false);
52
49
  $rootScope.isChecked = true;
53
- $rootScope.$digest();
54
50
  expect(element[0].checked).toBe(true);
55
51
  $rootScope.isChecked = false;
56
- $rootScope.$digest();
57
52
  expect(element[0].checked).toBe(false);
58
53
  });
59
54
 
60
55
  it("should bind string properties (title)", () => {
61
56
  const element = $compile('<span ng-prop-title="title" />')($rootScope);
62
57
  $rootScope.title = 123;
63
- $rootScope.$digest();
64
58
  expect(element[0].title).toBe("123");
65
59
  $rootScope.title = "foobar";
66
- $rootScope.$digest();
67
60
  expect(element[0].title).toBe("foobar");
68
61
  });
69
62
 
70
63
  it("should bind variable type properties", () => {
71
64
  const element = $compile('<span ng-prop-asdf="asdf" />')($rootScope);
72
65
  $rootScope.asdf = 123;
73
- $rootScope.$digest();
74
66
  expect(element[0].asdf).toBe(123);
75
67
  $rootScope.asdf = "foobar";
76
- $rootScope.$digest();
77
68
  expect(element[0].asdf).toBe("foobar");
78
69
  $rootScope.asdf = true;
79
- $rootScope.$digest();
80
70
  expect(element[0].asdf).toBe(true);
81
71
  });
82
72
 
@@ -85,31 +75,24 @@ fdescribe("ngProp*", () => {
85
75
  const element = $compile('<span ng-prop-text="myText" />')($rootScope);
86
76
  // Initialize to truthy value
87
77
  $rootScope.myText = "abc";
88
- $rootScope.$digest();
89
78
  expect(element[0].text).toBe("abc");
90
79
 
91
80
  // Assert various falsey values get assigned to the property
92
81
  $rootScope.myText = "";
93
- $rootScope.$digest();
94
82
  expect(element[0].text).toBe("");
95
83
  $rootScope.myText = 0;
96
- $rootScope.$digest();
97
84
  expect(element[0].text).toBe(0);
98
85
  $rootScope.myText = false;
99
- $rootScope.$digest();
100
86
  expect(element[0].text).toBe(false);
101
87
  $rootScope.myText = undefined;
102
- $rootScope.$digest();
103
88
  expect(element[0].text).toBeUndefined();
104
89
  $rootScope.myText = null;
105
- $rootScope.$digest();
106
90
  expect(element[0].text).toBe(null);
107
91
  });
108
92
 
109
93
  it("should directly map special properties (class)", () => {
110
94
  const element = $compile('<span ng-prop-class="myText" />')($rootScope);
111
95
  $rootScope.myText = "abc";
112
- $rootScope.$digest();
113
96
  expect(element[0].class).toBe("abc");
114
97
  expect(element[0]).not.toHaveClass("abc");
115
98
  });
@@ -117,7 +100,6 @@ fdescribe("ngProp*", () => {
117
100
  it("should support mixed case using underscore-separated names", () => {
118
101
  const element = $compile('<span ng-prop-a_bcd_e="value" />')($rootScope);
119
102
  $rootScope.value = 123;
120
- $rootScope.$digest();
121
103
  expect(element[0].aBcdE).toBe(123);
122
104
  });
123
105
 
@@ -136,7 +118,6 @@ fdescribe("ngProp*", () => {
136
118
  const element = $compile("<a ng-prop-href=\"'test/' + value\"></a>")(
137
119
  $rootScope,
138
120
  );
139
- $rootScope.$digest();
140
121
  expect(element[0].href).toMatch(/\/test\/test$/);
141
122
  });
142
123
 
@@ -158,7 +139,6 @@ fdescribe("ngProp*", () => {
158
139
  $rootScope,
159
140
  );
160
141
  $rootScope.asdf = 123;
161
- $rootScope.$digest();
162
142
  expect(element[0].asdf).toBe(123);
163
143
  expect(element.attr("asdf")).toBe("foo");
164
144
  });
@@ -168,7 +148,6 @@ fdescribe("ngProp*", () => {
168
148
  $rootScope,
169
149
  );
170
150
  $rootScope.asdf = 123;
171
- $rootScope.$digest();
172
151
  expect(element[0].asdf).toBe(123);
173
152
  expect(element.attr("asdf")).toBe("foo");
174
153
  });
@@ -278,7 +257,6 @@ fdescribe("ngProp*", () => {
278
257
  // Some browsers complain if you try to write `javascript:` into an `img[src]`
279
258
  // So for the test use something different
280
259
  $rootScope.testUrl = $sce.trustAsMediaUrl("someuntrustedthing:foo();");
281
- $rootScope.$digest();
282
260
  expect(element[0].src).toEqual("someuntrustedthing:foo();");
283
261
  });
284
262
 
@@ -330,33 +308,27 @@ fdescribe("ngProp*", () => {
330
308
  it("should NOT require trusted values for trusted URI values", () => {
331
309
  $rootScope.testUrl = "http://example.com/image.png"; // `http` is trusted
332
310
  let element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
333
- $rootScope.$digest();
334
311
  expect(element[0].href).toEqual("http://example.com/image.png");
335
312
 
336
313
  element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
337
- $rootScope.$digest();
338
314
  expect(element[0].href).toEqual("http://example.com/image.png");
339
315
  });
340
316
 
341
317
  it("should accept trusted values for non-trusted URI values", () => {
342
318
  $rootScope.testUrl = $sce.trustAsUrl("javascript:foo()"); // `javascript` is not trusted
343
319
  let element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
344
- $rootScope.$digest();
345
320
  expect(element[0].href).toEqual("javascript:foo()");
346
321
 
347
322
  element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
348
- $rootScope.$digest();
349
323
  expect(element[0].href).toEqual("javascript:foo()");
350
324
  });
351
325
 
352
326
  it("should sanitize non-trusted values", () => {
353
327
  $rootScope.testUrl = "javascript:foo()"; // `javascript` is not trusted
354
328
  let element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
355
- $rootScope.$digest();
356
329
  expect(element[0].href).toEqual("unsafe:javascript:foo()");
357
330
 
358
331
  element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
359
- $rootScope.$digest();
360
332
  expect(element[0].href).toEqual("unsafe:javascript:foo()");
361
333
  });
362
334
 
@@ -411,16 +383,9 @@ fdescribe("ngProp*", () => {
411
383
  "<foo ng-prop-href=\"'http://example.com/' + testUrl\"></foo><foo ng-prop-href=\"::'http://example.com/' + testUrl\"></foo>",
412
384
  )($rootScope);
413
385
  $rootScope.testUrl = [1];
414
- $rootScope.$digest();
415
-
416
386
  $rootScope.testUrl = [];
417
- $rootScope.$digest();
418
-
419
387
  $rootScope.testUrl = { a: "b" };
420
- $rootScope.$digest();
421
-
422
388
  $rootScope.testUrl = {};
423
- $rootScope.$digest();
424
389
  });
425
390
  });
426
391
 
@@ -638,7 +603,6 @@ fdescribe("ngProp*", () => {
638
603
  $rootScope,
639
604
  );
640
605
  $rootScope.html = '<div onclick="">hello</div>';
641
- $rootScope.$digest();
642
606
  expect(element.html()).toEqual('<div onclick="">hello</div>');
643
607
  });
644
608
 
@@ -647,10 +611,8 @@ fdescribe("ngProp*", () => {
647
611
  $rootScope,
648
612
  );
649
613
  $rootScope.html = "hello";
650
- $rootScope.$digest();
651
614
  expect(element.html()).toEqual("hello");
652
615
  $rootScope.html = "goodbye";
653
- $rootScope.$digest();
654
616
  expect(element.html()).toEqual("goodbye");
655
617
  });
656
618
 
@@ -660,11 +622,9 @@ fdescribe("ngProp*", () => {
660
622
  );
661
623
  $rootScope.html = '<div onclick="">hello</div>';
662
624
  expect($rootScope.$$watchers.length).toEqual(1);
663
- $rootScope.$digest();
664
625
  expect(element.text()).toEqual("hello");
665
626
  expect($rootScope.$$watchers.length).toEqual(0);
666
627
  $rootScope.html = '<div onclick="">hello</div>';
667
- $rootScope.$digest();
668
628
  expect(element.text()).toEqual("hello");
669
629
  });
670
630
  });
@@ -688,9 +648,7 @@ fdescribe("ngProp*", () => {
688
648
  $rootScope,
689
649
  );
690
650
  $rootScope.html = '<div onclick="">hello</div>';
691
- expect(() => {
692
- $rootScope.$digest();
693
- }).toThrowError(/unsafe/);
651
+ expect(() => {}).toThrowError(/unsafe/);
694
652
  });
695
653
 
696
654
  it("should NOT set html for wrongly typed values", () => {
@@ -698,9 +656,7 @@ fdescribe("ngProp*", () => {
698
656
  $rootScope,
699
657
  );
700
658
  $rootScope.html = $sce.trustAsCss('<div onclick="">hello</div>');
701
- expect(() => {
702
- $rootScope.$digest();
703
- }).toThrowError(/unsafe/);
659
+ expect(() => {}).toThrowError(/unsafe/);
704
660
  });
705
661
 
706
662
  it("should set html for trusted values", () => {
@@ -708,7 +664,6 @@ fdescribe("ngProp*", () => {
708
664
  $rootScope,
709
665
  );
710
666
  $rootScope.html = $sce.trustAsHtml('<div onclick="">hello</div>');
711
- $rootScope.$digest();
712
667
  expect(element.html()).toEqual('<div onclick="">hello</div>');
713
668
  });
714
669
 
@@ -717,10 +672,8 @@ fdescribe("ngProp*", () => {
717
672
  $rootScope,
718
673
  );
719
674
  $rootScope.html = $sce.trustAsHtml("hello");
720
- $rootScope.$digest();
721
675
  expect(element.html()).toEqual("hello");
722
676
  $rootScope.html = $sce.trustAsHtml("goodbye");
723
- $rootScope.$digest();
724
677
  expect(element.html()).toEqual("goodbye");
725
678
  });
726
679
 
@@ -734,7 +687,6 @@ fdescribe("ngProp*", () => {
734
687
  $rootScope.getHtml = function () {
735
688
  return $sce.trustAsHtml('<div onclick="">hello</div>');
736
689
  };
737
- $rootScope.$digest();
738
690
  expect(element.html()).toEqual('<div onclick="">hello</div>');
739
691
  });
740
692
 
@@ -775,10 +727,8 @@ fdescribe("ngProp*", () => {
775
727
  $rootScope.getHtml = function () {
776
728
  return $sce.trustAsHtml(html);
777
729
  };
778
- $rootScope.$digest();
779
730
  expect(element.html()).toEqual("hello");
780
731
  html = "goodbye";
781
- $rootScope.$digest();
782
732
  expect(element.html()).toEqual("goodbye");
783
733
  });
784
734
  });
@@ -788,24 +738,18 @@ fdescribe("ngProp*", () => {
788
738
  it("should NOT set style for untrusted values", () => {
789
739
  const element = $compile('<div ng-prop-style="style"></div>')($rootScope);
790
740
  $rootScope.style = "margin-left: 10px";
791
- expect(() => {
792
- $rootScope.$digest();
793
- }).toThrowError(/unsafe/);
741
+ expect(() => {}).toThrowError(/unsafe/);
794
742
  });
795
743
 
796
744
  it("should NOT set style for wrongly typed values", () => {
797
745
  const element = $compile('<div ng-prop-style="style"></div>')($rootScope);
798
746
  $rootScope.style = $sce.trustAsHtml("margin-left: 10px");
799
- expect(() => {
800
- $rootScope.$digest();
801
- }).toThrowError(/unsafe/);
747
+ expect(() => {}).toThrowError(/unsafe/);
802
748
  });
803
749
 
804
750
  it("should set style for trusted values", () => {
805
751
  const element = $compile('<div ng-prop-style="style"></div>')($rootScope);
806
752
  $rootScope.style = $sce.trustAsCss("margin-left: 10px");
807
- $rootScope.$digest();
808
-
809
753
  expect(element[0].style["margin-left"]).toEqual("10px");
810
754
  });
811
755
  });
@@ -4,7 +4,6 @@ import {
4
4
  urlResolve,
5
5
  } from "./../url-utils/url-utils";
6
6
  import {
7
- forEach,
8
7
  isFunction,
9
8
  isRegExp,
10
9
  isString,
@@ -731,7 +730,7 @@ export function SceProvider() {
731
730
  const { getTrusted } = sce;
732
731
  const { trustAs } = sce;
733
732
 
734
- forEach(SCE_CONTEXTS, (enumValue, name) => {
733
+ Object.entries(SCE_CONTEXTS).forEach(([name, enumValue]) => {
735
734
  const lName = lowercase(name);
736
735
  sce[snakeToCamel(`parse_as_${lName}`)] = function (expr) {
737
736
  return parse(enumValue, expr);
@@ -202,18 +202,14 @@ describe("SCE", () => {
202
202
  logs.push(`${value}`);
203
203
  });
204
204
 
205
- $rootScope.$digest();
206
205
  expect(logs[0]).toEqual("undefined"); // initial listener call
207
206
 
208
207
  $rootScope.foo = $sce.trustAs($sce.HTML, "trustedValue");
209
208
  expect($rootScope.$$watchers.length).toBe(1);
210
- $rootScope.$digest();
211
-
212
209
  expect($rootScope.$$watchers.length).toBe(0);
213
210
  expect(logs[1]).toEqual("trustedValue");
214
211
 
215
212
  $rootScope.foo = $sce.trustAs($sce.HTML, "anotherTrustedValue");
216
- $rootScope.$digest();
217
213
  expect(logs[2]).toBeUndefined(); // watcher no longer active
218
214
  });
219
215
 
@@ -222,18 +218,14 @@ describe("SCE", () => {
222
218
  logs.push(`${value}`);
223
219
  });
224
220
 
225
- $rootScope.$digest();
226
221
  expect(logs[0]).toEqual("undefined"); // initial listener call
227
222
 
228
223
  $rootScope.foo = $sce.trustAs($sce.URL, "trustedValue");
229
224
  expect($rootScope.$$watchers.length).toBe(1);
230
- $rootScope.$digest();
231
-
232
225
  expect($rootScope.$$watchers.length).toBe(0);
233
226
  expect(logs[1]).toEqual("trustedValue");
234
227
 
235
228
  $rootScope.foo = $sce.trustAs($sce.URL, "anotherTrustedValue");
236
- $rootScope.$digest();
237
229
  expect(logs[2]).toBeUndefined(); // watcher no longer active
238
230
  });
239
231
 
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  concat,
3
- forEach,
4
3
  minErr,
5
4
  nextUid,
6
5
  isFunction,
@@ -58,7 +57,7 @@ const $rootScopeMinErr = minErr("$rootScope");
58
57
 
59
58
  /** @type {AsyncQueueTask[]} */
60
59
  export const $$asyncQueue = [];
61
- export const $$postDigestQueue = [];
60
+ export const $postUpdateQueue = [];
62
61
 
63
62
  /**
64
63
  * @type {Function[]}
@@ -209,11 +208,6 @@ export class Scope {
209
208
  /** @type {number} */
210
209
  this.$$watchersCount = 0;
211
210
  this.$$isolateBindings = null;
212
-
213
- /**
214
- * @type {?Scope}
215
- */
216
- this.$$ChildScope = null;
217
211
  }
218
212
 
219
213
  /**
@@ -231,16 +225,11 @@ export class Scope {
231
225
  * When creating widgets, it is useful for the widget to not accidentally read parent
232
226
  * state.
233
227
  *
234
- * @param {?Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
235
- * of the newly created scope. Defaults to `this` scope if not provided.
236
- * This is used when creating a transclude scope to correctly place it
237
- * in the scope hierarchy while maintaining the correct prototypical
238
- * inheritance.
239
228
  *
240
229
  * @returns {Scope} The newly created child scope.
241
230
  *
242
231
  */
243
- $new(isolate, parent) {
232
+ $new(isolate) {
244
233
  let child = isolate ? new Scope() : Object.create(this);
245
234
 
246
235
  if (isolate) {
@@ -255,11 +244,10 @@ export class Scope {
255
244
  child.$$listeners = new Map();
256
245
  child.$$listenerCount = {};
257
246
  child.$$watchersCount = 0;
258
- child.$$ChildScope = null;
259
247
  child.$$suspended = false;
260
248
  }
261
249
 
262
- child.$parent = parent || this;
250
+ child.$parent = this;
263
251
  child.$$prevSibling = child.$parent.$$childTail;
264
252
 
265
253
  if (child.$parent.$$childHead) {
@@ -271,7 +259,7 @@ export class Scope {
271
259
  }
272
260
 
273
261
  // Add a destroy listener if isolated or the parent differs from `this`
274
- if (isolate || parent !== this) {
262
+ if (isolate) {
275
263
  child.$on("$destroy", ($event) => {
276
264
  $event.currentScope.$$destroyed = true;
277
265
  });
@@ -280,6 +268,49 @@ export class Scope {
280
268
  return child;
281
269
  }
282
270
 
271
+ /**
272
+ * Creates a transcluded scope
273
+ * @param {Scope} parent The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
274
+ * of the newly created scope. This is used when creating a transclude scope to correctly place it
275
+ * in the scope hierarchy while maintaining the correct prototypical inheritance.
276
+ *
277
+ * @returns {Scope} The newly created child scope.
278
+ *
279
+ */
280
+ $transcluded(parent) {
281
+ let child = Object.create(this);
282
+
283
+ // Initialize properties for a non-isolated child scope
284
+ child.$id = nextUid();
285
+ child.$$watchers = [];
286
+ child.$$nextSibling = null;
287
+ child.$$childHead = null;
288
+ child.$$childTail = null;
289
+ child.$$listeners = new Map();
290
+ child.$$listenerCount = {};
291
+ child.$$watchersCount = 0;
292
+ child.$$suspended = false;
293
+
294
+ child.$parent = parent || this;
295
+ child.$$prevSibling = child.$parent.$$childTail;
296
+
297
+ if (child.$parent.$$childHead) {
298
+ child.$parent.$$childTail.$$nextSibling = child;
299
+ child.$parent.$$childTail = child;
300
+ } else {
301
+ child.$parent.$$childHead = child;
302
+ child.$parent.$$childTail = child;
303
+ }
304
+
305
+ // Add a destroy listener if isolated or the parent differs from `this`
306
+ if (parent !== this) {
307
+ child.$on("$destroy", ($event) => {
308
+ $event.currentScope.$$destroyed = true;
309
+ });
310
+ }
311
+
312
+ return child;
313
+ }
283
314
  /**
284
315
  * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
285
316
  *
@@ -332,16 +363,16 @@ export class Scope {
332
363
  });
333
364
  expect(scope.counter).toEqual(0);
334
365
 
335
- scope.$digest();
366
+ ;
336
367
  // the listener is always called during the first $digest loop after it was registered
337
368
  expect(scope.counter).toEqual(1);
338
369
 
339
- scope.$digest();
370
+ ;
340
371
  // but now it will not be called unless the value changes
341
372
  expect(scope.counter).toEqual(1);
342
373
 
343
374
  scope.name = 'adam';
344
- scope.$digest();
375
+ ;
345
376
  expect(scope.counter).toEqual(2);
346
377
 
347
378
  // Using a function as a watchExpression
@@ -363,12 +394,12 @@ export class Scope {
363
394
  expect(scope.foodCounter).toEqual(0);
364
395
 
365
396
  // Run the digest but since food has not changed count will still be zero
366
- scope.$digest();
397
+ ;
367
398
  expect(scope.foodCounter).toEqual(0);
368
399
 
369
400
  // Update food and run digest. Now the counter will increment
370
401
  food = 'cheeseburger';
371
- scope.$digest();
402
+ ;
372
403
  expect(scope.foodCounter).toEqual(1);
373
404
 
374
405
  * ```
@@ -473,7 +504,7 @@ export class Scope {
473
504
  });
474
505
  }
475
506
 
476
- forEach(watchExpressions, (expr, i) => {
507
+ Object.entries(watchExpressions).forEach(([i, expr]) => {
477
508
  const unwatchFn = self.$watch(expr, (value) => {
478
509
  newValues[i] = value;
479
510
  if (!changeReactionScheduled) {
@@ -675,7 +706,6 @@ export class Scope {
675
706
  }
676
707
  }
677
708
  }
678
- // TODO: fix this type signature
679
709
  return this.$watch(changeDetector, $watchCollectionAction);
680
710
  }
681
711
 
@@ -711,16 +741,16 @@ export class Scope {
711
741
  });
712
742
  expect(scope.counter).toEqual(0);
713
743
 
714
- scope.$digest();
744
+ ;
715
745
  // the listener is always called during the first $digest loop after it was registered
716
746
  expect(scope.counter).toEqual(1);
717
747
 
718
- scope.$digest();
748
+ ;
719
749
  // but now it will not be called unless the value changes
720
750
  expect(scope.counter).toEqual(1);
721
751
 
722
752
  scope.name = 'adam';
723
- scope.$digest();
753
+ ;
724
754
  expect(scope.counter).toEqual(2);
725
755
  * ```
726
756
  *
@@ -862,14 +892,14 @@ export class Scope {
862
892
  this.clearPhase();
863
893
 
864
894
  // postDigestQueuePosition isn't local here because this loop can be reentered recursively.
865
- while (postDigestQueuePosition < $$postDigestQueue.length) {
895
+ while (postDigestQueuePosition < $postUpdateQueue.length) {
866
896
  try {
867
- $$postDigestQueue[postDigestQueuePosition++]();
897
+ $postUpdateQueue[postDigestQueuePosition++]();
868
898
  } catch (e) {
869
899
  $exceptionHandler(e);
870
900
  }
871
901
  }
872
- $$postDigestQueue.length = postDigestQueuePosition = 0;
902
+ $postUpdateQueue.length = postDigestQueuePosition = 0;
873
903
 
874
904
  // Check for changes to browser url that happened during the $digest
875
905
  // (for which no event is fired; e.g. via `history.pushState()`)
@@ -906,7 +936,7 @@ export class Scope {
906
936
  * Some of the things to consider are:
907
937
  *
908
938
  * * Any external event on a directive/component will not trigger a digest while the hosting
909
- * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`.
939
+ * scope is suspended - even if the event handler calls `$apply()` or ``.
910
940
  * * Transcluded content exists on a scope that inherits from outside a directive but exists
911
941
  * as a child of the directive's containing scope. If the containing scope is suspended the
912
942
  * transcluded scope will also be suspended, even if the scope from which the transcluded
@@ -1120,8 +1150,8 @@ export class Scope {
1120
1150
  return id;
1121
1151
  }
1122
1152
 
1123
- $$postDigest(fn) {
1124
- $$postDigestQueue.push(fn);
1153
+ $postUpdate(fn) {
1154
+ $postUpdateQueue.push(fn);
1125
1155
  }
1126
1156
 
1127
1157
  /**