@angular-wave/angular.ts 0.4.3 → 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.
- package/dist/angular-ts.umd.js +10 -0
- package/index.html +74 -3
- package/package.json +1 -1
- package/src/angular.spec.js +0 -5
- package/src/animations/animate-css.js +5 -13
- package/src/animations/animate-queue.js +22 -21
- package/src/animations/animate-runner.js +4 -8
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +0 -21
- package/src/animations/animation.js +1 -1
- package/src/binding.spec.js +0 -1
- package/src/core/cache/cache.js +2 -29
- package/src/core/compile/compile.js +26 -27
- package/src/core/compile/compile.spec.js +17 -266
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/controller/controller.js +2 -0
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +0 -2
- package/src/core/di/internal-injector.js +2 -1
- package/src/core/interpolate/interpolate.js +16 -3
- package/src/core/interpolate/interpolate.spec.js +70 -16
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/location/location.js +0 -2
- package/src/core/location/location.spec.js +27 -27
- package/src/core/{scope/scope.html → model/model.html} +1 -1
- package/src/core/model/model.js +944 -0
- package/src/core/model/model.spec.js +3012 -0
- package/src/core/on.spec.js +0 -7
- package/src/core/parse/interpreter.js +10 -7
- package/src/core/parse/parse.js +26 -5
- package/src/core/parse/parse.spec.js +95 -91
- package/src/core/prop.spec.js +4 -60
- package/src/core/sce/sce.spec.js +0 -8
- package/src/core/scope/scope.js +61 -30
- package/src/core/scope/scope.spec.js +25 -1960
- package/src/directive/aria/aria.js +3 -6
- package/src/directive/aria/aria.spec.js +0 -87
- package/src/directive/attrs/attrs.spec.js +0 -5
- package/src/directive/attrs/boolean.spec.js +0 -15
- package/src/directive/attrs/element-style.spec.js +0 -8
- package/src/directive/attrs/src.spec.js +0 -7
- package/src/directive/bind/bind.spec.js +0 -33
- package/src/directive/bind/bing-html.spec.js +0 -3
- package/src/{core/q/q.html → directive/channel/channel.html} +1 -1
- package/src/directive/channel/channel.js +29 -0
- package/src/directive/channel/channel.spec.js +52 -0
- package/src/directive/{list/list.test.js → channel/channel.test.js} +2 -4
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +9 -75
- package/src/directive/controller/controller.spec.js +0 -13
- package/src/directive/events/click.spec.js +0 -3
- package/src/directive/events/event.spec.js +0 -6
- package/src/directive/form/form.js +2 -3
- package/src/directive/form/form.spec.js +0 -65
- package/src/directive/if/if.spec.js +0 -4
- package/src/directive/include/include.spec.js +8 -59
- package/src/directive/init/init.js +6 -2
- package/src/directive/init/init.spec.js +0 -2
- package/src/directive/input/input.spec.js +0 -136
- package/src/directive/messages/messages.spec.js +4 -35
- package/src/directive/model/model.js +18 -25
- package/src/directive/model/model.spec.js +2 -49
- package/src/directive/model-options/model-options.spec.js +0 -6
- package/src/directive/non-bindable/non-bindable.spec.js +0 -1
- package/src/directive/observe/observe.js +0 -1
- package/src/directive/observe/observe.spec.js +0 -1
- package/src/directive/options/options.spec.js +0 -34
- package/src/directive/ref/href.spec.js +0 -15
- package/src/directive/repeat/repeat.spec.js +8 -135
- package/src/directive/script/script.spec.js +0 -2
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +0 -96
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +8 -19
- package/src/directive/style/style.spec.js +0 -7
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +0 -1
- package/src/loader.js +0 -1
- package/src/public.js +75 -80
- package/src/router/common/coreservices.js +0 -2
- package/src/router/directives/state-directives.js +6 -14
- package/src/router/directives/state-directives.spec.js +0 -83
- package/src/router/directives/view-directive.js +4 -13
- package/src/router/directives/view-directive.spec.js +25 -71
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +3 -5
- package/src/router/resolve/resolvable.js +3 -6
- package/src/router/resolve/resolve-context.js +2 -2
- package/src/router/state/state-service.js +4 -4
- package/src/router/state/state.spec.js +2 -5
- package/src/router/state/views.js +7 -10
- package/src/router/template-factory.js +3 -6
- package/src/router/template-factory.spec.js +0 -4
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +4 -6
- package/src/services/http/http.js +6 -9
- package/src/services/http/http.spec.js +30 -31
- package/src/services/http/template-request.spec.js +0 -10
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +2 -4
- package/src/shared/common.js +1 -2
- package/src/shared/jqlite/jqlite.js +0 -3
- package/types/core/cache/cache.d.ts +1 -1
- package/types/core/model/model.d.ts +204 -0
- package/types/core/parse/parse.d.ts +26 -0
- package/types/core/scope/scope.d.ts +22 -21
- package/types/directive/channel/channel.d.ts +11 -0
- package/src/core/interval/interval-factory.js +0 -50
- package/src/core/interval/interval.html +0 -18
- package/src/core/interval/interval.js +0 -77
- package/src/core/interval/interval.md +0 -123
- package/src/core/interval/interval.spec.js +0 -280
- package/src/core/q/q.js +0 -472
- package/src/core/q/q.md +0 -211
- package/src/core/q/q.spec.js +0 -2748
- package/src/core/q/q.test.js +0 -12
- package/src/core/scope/scope.test.js +0 -12
- package/src/core/timeout/timeout.html +0 -18
- package/src/core/timeout/timeout.js +0 -109
- package/src/core/timeout/timeout.spec.js +0 -354
- package/src/core/timeout/timout.test.js +0 -12
- package/src/directive/list/list.html +0 -18
- package/src/directive/list/list.js +0 -46
- package/src/directive/list/list.md +0 -22
- package/src/directive/list/list.spec.js +0 -172
- package/types/directive/list/list.d.ts +0 -4
package/index.html
CHANGED
|
@@ -4,8 +4,79 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<title>AngularTS</title>
|
|
6
6
|
<link rel="shortcut icon" type="image/png" href="images/favicon.ico">
|
|
7
|
+
<script type="module" src="/src/index.js"></script>
|
|
8
|
+
<script> document.addEventListener("DOMContentLoaded", () => {
|
|
9
|
+
class Todo {
|
|
10
|
+
constructor(task) {
|
|
11
|
+
this.task = task;
|
|
12
|
+
this.done = false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class TodoController {
|
|
16
|
+
constructor($element) {
|
|
17
|
+
this.greeting = "Todos";
|
|
18
|
+
this.counter = 123
|
|
19
|
+
this.tasks = [
|
|
20
|
+
new Todo("Learn AngularTS"),
|
|
21
|
+
new Todo("Build an AngularTS app"),
|
|
22
|
+
];
|
|
23
|
+
window.test = this
|
|
24
|
+
setInterval(() => {
|
|
25
|
+
window.test = $element.controller()
|
|
26
|
+
}, 1000);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
increase() {
|
|
30
|
+
console.log(this)
|
|
31
|
+
this.counter++
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {String} task
|
|
37
|
+
* @return {void}
|
|
38
|
+
*/
|
|
39
|
+
add(task) {
|
|
40
|
+
this.tasks.push(new Todo(task));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Delete all finished tasks
|
|
45
|
+
* @return {void}
|
|
46
|
+
*/
|
|
47
|
+
archive() {
|
|
48
|
+
this.tasks = this.tasks.filter((task) => !task.done);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class Demo {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.test = "DemoCtrl"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
window.angular.module("todo", [])
|
|
58
|
+
.controller("TodoCtrl", TodoController).controller("DemoCtrl", Demo);
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
7
61
|
</head>
|
|
8
|
-
<body>
|
|
9
|
-
|
|
10
|
-
|
|
62
|
+
<body ng-app="todo" ng-init="b = 1" ng-cloak>
|
|
63
|
+
<div id="2" ng-controller="TodoCtrl" >
|
|
64
|
+
First
|
|
65
|
+
{{ counter }}
|
|
66
|
+
|
|
67
|
+
<div ng-if="test">
|
|
68
|
+
VISIBLE
|
|
69
|
+
</div>
|
|
70
|
+
<input type="checkbox" ng-model="test">
|
|
71
|
+
{{ test }}
|
|
72
|
+
|
|
73
|
+
</div>
|
|
74
|
+
<div>
|
|
75
|
+
<input ng-model="b" />
|
|
76
|
+
{{ b }}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<input ng-model="b" />
|
|
80
|
+
|
|
81
|
+
</body>
|
|
11
82
|
</html>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@angular-wave/angular.ts",
|
|
3
3
|
"description": "A modern, optimized and typesafe version of AngularJS",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"browser": "dist/angular-ts.umd.js",
|
package/src/angular.spec.js
CHANGED
|
@@ -1519,7 +1519,6 @@ describe("angular", () => {
|
|
|
1519
1519
|
'<div>{{greeting = "hello world"}}</div>',
|
|
1520
1520
|
);
|
|
1521
1521
|
element = $compile(template)($rootScope);
|
|
1522
|
-
$rootScope.$digest();
|
|
1523
1522
|
expect(template.text()).toEqual("hello world");
|
|
1524
1523
|
expect($rootScope.greeting).toEqual("hello world");
|
|
1525
1524
|
});
|
|
@@ -1529,7 +1528,6 @@ describe("angular", () => {
|
|
|
1529
1528
|
'<div>{{greeting = "hello world"}}</div>',
|
|
1530
1529
|
);
|
|
1531
1530
|
element = $compile(template)($rootScope);
|
|
1532
|
-
$rootScope.$digest();
|
|
1533
1531
|
expect(template.text()).toEqual("hello world");
|
|
1534
1532
|
});
|
|
1535
1533
|
|
|
@@ -1542,8 +1540,6 @@ describe("angular", () => {
|
|
|
1542
1540
|
element = compile($rootScope, (clone) => {
|
|
1543
1541
|
templateClone = clone;
|
|
1544
1542
|
});
|
|
1545
|
-
$rootScope.$digest();
|
|
1546
|
-
|
|
1547
1543
|
expect(template.text()).toEqual('{{greeting = "hello world"}}');
|
|
1548
1544
|
expect(element.text()).toEqual("hello world");
|
|
1549
1545
|
expect(element).toEqual(templateClone);
|
|
@@ -1553,7 +1549,6 @@ describe("angular", () => {
|
|
|
1553
1549
|
it("should link to cloned node and create scope", () => {
|
|
1554
1550
|
const template = JQLite('<div>{{greeting = "hello world"}}</div>');
|
|
1555
1551
|
element = $compile(template)($rootScope, () => {});
|
|
1556
|
-
$rootScope.$digest();
|
|
1557
1552
|
expect(template.text()).toEqual('{{greeting = "hello world"}}');
|
|
1558
1553
|
expect(element.text()).toEqual("hello world");
|
|
1559
1554
|
expect($rootScope.greeting).toEqual("hello world");
|
|
@@ -139,7 +139,6 @@ function registerRestorableStyles(backup, node, properties) {
|
|
|
139
139
|
export function AnimateCssProvider() {
|
|
140
140
|
this.$get = [
|
|
141
141
|
"$$AnimateRunner",
|
|
142
|
-
"$timeout",
|
|
143
142
|
"$$animateCache",
|
|
144
143
|
"$$rAFScheduler",
|
|
145
144
|
"$$animateQueue",
|
|
@@ -147,19 +146,12 @@ export function AnimateCssProvider() {
|
|
|
147
146
|
/**
|
|
148
147
|
*
|
|
149
148
|
* @param {*} $$AnimateRunner
|
|
150
|
-
* @param {*} $timeout
|
|
151
149
|
* @param {*} $$animateCache
|
|
152
150
|
* @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
|
|
153
151
|
* @param {*} $$animateQueue
|
|
154
152
|
* @returns
|
|
155
153
|
*/
|
|
156
|
-
function (
|
|
157
|
-
$$AnimateRunner,
|
|
158
|
-
$timeout,
|
|
159
|
-
$$animateCache,
|
|
160
|
-
$$rAFScheduler,
|
|
161
|
-
$$animateQueue,
|
|
162
|
-
) {
|
|
154
|
+
function ($$AnimateRunner, $$animateCache, $$rAFScheduler, $$animateQueue) {
|
|
163
155
|
const applyAnimationClasses = applyAnimationClassesFactory();
|
|
164
156
|
|
|
165
157
|
function computeCachedCssStyles(
|
|
@@ -635,7 +627,7 @@ export function AnimateCssProvider() {
|
|
|
635
627
|
// Cancel the fallback closing timeout and remove the timer data
|
|
636
628
|
const animationTimerData = element.data(ANIMATE_TIMER_KEY);
|
|
637
629
|
if (animationTimerData) {
|
|
638
|
-
|
|
630
|
+
clearTimeout(animationTimerData[0].timer);
|
|
639
631
|
element.removeData(ANIMATE_TIMER_KEY);
|
|
640
632
|
}
|
|
641
633
|
|
|
@@ -749,7 +741,7 @@ export function AnimateCssProvider() {
|
|
|
749
741
|
(timings.animationDuration && stagger.animationDuration === 0)) &&
|
|
750
742
|
Math.max(stagger.animationDelay, stagger.transitionDelay);
|
|
751
743
|
if (maxStagger) {
|
|
752
|
-
|
|
744
|
+
setTimeout(
|
|
753
745
|
triggerAnimationStart,
|
|
754
746
|
Math.floor(maxStagger * itemIndex * ONE_SECOND),
|
|
755
747
|
false,
|
|
@@ -857,14 +849,14 @@ export function AnimateCssProvider() {
|
|
|
857
849
|
const currentTimerData = animationsData[0];
|
|
858
850
|
setupFallbackTimer = endTime > currentTimerData.expectedEndTime;
|
|
859
851
|
if (setupFallbackTimer) {
|
|
860
|
-
|
|
852
|
+
clearTimeout(currentTimerData.timer);
|
|
861
853
|
} else {
|
|
862
854
|
animationsData.push(close);
|
|
863
855
|
}
|
|
864
856
|
}
|
|
865
857
|
|
|
866
858
|
if (setupFallbackTimer) {
|
|
867
|
-
const timer =
|
|
859
|
+
const timer = setTimeout(onAnimationExpired, timerTime, false);
|
|
868
860
|
animationsData[0] = {
|
|
869
861
|
timer,
|
|
870
862
|
expectedEndTime: endTime,
|
|
@@ -182,7 +182,7 @@ export function AnimateQueueProvider($animateProvider) {
|
|
|
182
182
|
if (postDigestCalled) {
|
|
183
183
|
fn();
|
|
184
184
|
} else {
|
|
185
|
-
$rootScope
|
|
185
|
+
$rootScope.$postUpdate(() => {
|
|
186
186
|
postDigestCalled = true;
|
|
187
187
|
fn();
|
|
188
188
|
});
|
|
@@ -194,29 +194,30 @@ export function AnimateQueueProvider($animateProvider) {
|
|
|
194
194
|
// compiled. The $templateRequest.totalPendingRequests variable keeps track of
|
|
195
195
|
// all of the remote templates being currently downloaded. If there are no
|
|
196
196
|
// templates currently downloading then the watcher will still fire anyway.
|
|
197
|
-
$rootScope["
|
|
197
|
+
$rootScope["templateRequest"] = $templateRequest;
|
|
198
198
|
const deregisterWatch = $rootScope.$watch(
|
|
199
199
|
"$templateRequest.totalPendingRequests",
|
|
200
200
|
(val) => {
|
|
201
|
-
if (val
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
201
|
+
if (val === 0) {
|
|
202
|
+
deregisterWatch();
|
|
203
|
+
$rootScope["$templateRequest"] = undefined;
|
|
204
|
+
// Now that all templates have been downloaded, $animate will wait until
|
|
205
|
+
// the post digest queue is empty before enabling animations. By having two
|
|
206
|
+
// calls to $postDigest calls we can ensure that the flag is enabled at the
|
|
207
|
+
// very end of the post digest queue. Since all of the animations in $animate
|
|
208
|
+
// use $postDigest, it's important that the code below executes at the end.
|
|
209
|
+
// This basically means that the page is fully downloaded and compiled before
|
|
210
|
+
// any animations are triggered.
|
|
211
|
+
$rootScope.$postUpdate(() => {
|
|
212
|
+
$rootScope.$postUpdate(() => {
|
|
213
|
+
// we check for null directly in the event that the application already called
|
|
214
|
+
// .enabled() with whatever arguments that it provided it with
|
|
215
|
+
if (animationsEnabled === null) {
|
|
216
|
+
animationsEnabled = true;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
218
219
|
});
|
|
219
|
-
}
|
|
220
|
+
}
|
|
220
221
|
},
|
|
221
222
|
);
|
|
222
223
|
|
|
@@ -597,7 +598,7 @@ export function AnimateQueueProvider($animateProvider) {
|
|
|
597
598
|
|
|
598
599
|
markElementAnimationState(node, PRE_DIGEST_STATE, newAnimation);
|
|
599
600
|
|
|
600
|
-
$rootScope
|
|
601
|
+
$rootScope.$postUpdate(() => {
|
|
601
602
|
// It is possible that the DOM nodes inside `originalElement` have been replaced. This can
|
|
602
603
|
// happen if the animated element is a transcluded clone and also has a `templateUrl`
|
|
603
604
|
// directive on it. Therefore, we must recreate `element` in order to interact with the
|
|
@@ -34,17 +34,13 @@ export function AnimateAsyncRunFactoryProvider() {
|
|
|
34
34
|
const INITIAL_STATE = 0;
|
|
35
35
|
const DONE_PENDING_STATE = 1;
|
|
36
36
|
const DONE_COMPLETE_STATE = 2;
|
|
37
|
-
let
|
|
37
|
+
let $$animateAsyncRun;
|
|
38
38
|
|
|
39
39
|
export function AnimateRunnerFactoryProvider() {
|
|
40
40
|
this.$get = [
|
|
41
|
-
"$q",
|
|
42
41
|
"$$animateAsyncRun",
|
|
43
|
-
|
|
44
|
-
function (q, animateAsyncRun, timeout) {
|
|
45
|
-
$q = q;
|
|
42
|
+
function (animateAsyncRun) {
|
|
46
43
|
$$animateAsyncRun = animateAsyncRun;
|
|
47
|
-
$timeout = timeout;
|
|
48
44
|
return AnimateRunner;
|
|
49
45
|
},
|
|
50
46
|
];
|
|
@@ -94,7 +90,7 @@ export class AnimateRunner {
|
|
|
94
90
|
|
|
95
91
|
const rafTick = $$animateAsyncRun();
|
|
96
92
|
const timeoutTick = (fn) => {
|
|
97
|
-
|
|
93
|
+
setTimeout(fn, 0, false);
|
|
98
94
|
};
|
|
99
95
|
|
|
100
96
|
this._doneCallbacks = [];
|
|
@@ -125,7 +121,7 @@ export class AnimateRunner {
|
|
|
125
121
|
getPromise() {
|
|
126
122
|
if (!this.promise) {
|
|
127
123
|
const self = this;
|
|
128
|
-
this.promise =
|
|
124
|
+
this.promise = new Promise((resolve, reject) => {
|
|
129
125
|
self.done((status) => {
|
|
130
126
|
if (status === false) {
|
|
131
127
|
reject();
|
|
@@ -82,7 +82,6 @@ describe("$animate", () => {
|
|
|
82
82
|
$animate.enabled(false);
|
|
83
83
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
84
84
|
$animate.addClass(element, "ng-hide");
|
|
85
|
-
$rootScope.$digest();
|
|
86
85
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
87
86
|
});
|
|
88
87
|
|
|
@@ -117,10 +116,8 @@ describe("$animate", () => {
|
|
|
117
116
|
$animate.enabled(false);
|
|
118
117
|
expect(rect[0].classList.contains("ng-hide")).toBeFalse();
|
|
119
118
|
$animate.addClass(rect, "ng-hide");
|
|
120
|
-
$rootScope.$digest();
|
|
121
119
|
expect(rect[0].classList.contains("ng-hide")).toBeTrue();
|
|
122
120
|
$animate.removeClass(rect, "ng-hide");
|
|
123
|
-
$rootScope.$digest();
|
|
124
121
|
expect(rect[0].classList.contains("ng-hide")).toBeFalse();
|
|
125
122
|
});
|
|
126
123
|
|
|
@@ -171,25 +168,21 @@ describe("$animate", () => {
|
|
|
171
168
|
$animate.addClass(element, "on", {
|
|
172
169
|
to: { color: "green" },
|
|
173
170
|
});
|
|
174
|
-
$rootScope.$digest();
|
|
175
171
|
assertColor("green");
|
|
176
172
|
|
|
177
173
|
$animate.setClass(element, "off", "on", {
|
|
178
174
|
to: { color: "black" },
|
|
179
175
|
});
|
|
180
|
-
$rootScope.$digest();
|
|
181
176
|
assertColor("black");
|
|
182
177
|
|
|
183
178
|
$animate.removeClass(element, "off", {
|
|
184
179
|
to: { color: "blue" },
|
|
185
180
|
});
|
|
186
|
-
$rootScope.$digest();
|
|
187
181
|
assertColor("blue");
|
|
188
182
|
|
|
189
183
|
$animate.leave(element, {
|
|
190
184
|
to: { color: "yellow" },
|
|
191
185
|
});
|
|
192
|
-
$rootScope.$digest();
|
|
193
186
|
assertColor("yellow");
|
|
194
187
|
|
|
195
188
|
function assertColor(color) {
|
|
@@ -205,8 +198,6 @@ describe("$animate", () => {
|
|
|
205
198
|
from: { color: "green" },
|
|
206
199
|
to: { borderColor: "purple" },
|
|
207
200
|
});
|
|
208
|
-
$rootScope.$digest();
|
|
209
|
-
|
|
210
201
|
const { style } = element[0];
|
|
211
202
|
expect(style.color).toBe("green");
|
|
212
203
|
expect(style.borderColor).toBe("purple");
|
|
@@ -217,8 +208,6 @@ describe("$animate", () => {
|
|
|
217
208
|
|
|
218
209
|
$animate.addClass(element, "ng-hide");
|
|
219
210
|
$animate.removeClass(element, "ng-hide");
|
|
220
|
-
$rootScope.$digest();
|
|
221
|
-
|
|
222
211
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
223
212
|
});
|
|
224
213
|
|
|
@@ -227,8 +216,6 @@ describe("$animate", () => {
|
|
|
227
216
|
|
|
228
217
|
$animate.removeClass(element, "ng-hide");
|
|
229
218
|
$animate.addClass(element, "ng-hide");
|
|
230
|
-
$rootScope.$digest();
|
|
231
|
-
|
|
232
219
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
233
220
|
});
|
|
234
221
|
|
|
@@ -338,7 +325,6 @@ describe("$animate", () => {
|
|
|
338
325
|
|
|
339
326
|
expect(() => {
|
|
340
327
|
fn();
|
|
341
|
-
$rootScope.$digest();
|
|
342
328
|
}).not.toThrow();
|
|
343
329
|
|
|
344
330
|
const optionsArg = captureSpy.calls.mostRecent().args[2];
|
|
@@ -353,8 +339,6 @@ describe("$animate", () => {
|
|
|
353
339
|
|
|
354
340
|
$animate.enter(element1, $rootElement, null, { addClass: " " });
|
|
355
341
|
$animate.enter(element2, $rootElement, null, { addClass: "valid-name" });
|
|
356
|
-
$rootScope.$digest();
|
|
357
|
-
|
|
358
342
|
expect(element2[0].classList.contains("valid-name")).toBeTruthy();
|
|
359
343
|
});
|
|
360
344
|
|
|
@@ -375,7 +359,6 @@ describe("$animate", () => {
|
|
|
375
359
|
const runner = $animate.enter(element, parent, null, copiedOptions);
|
|
376
360
|
expect(copiedOptions).toEqual(initialOptions);
|
|
377
361
|
|
|
378
|
-
$rootScope.$digest();
|
|
379
362
|
expect(copiedOptions).toEqual(initialOptions);
|
|
380
363
|
});
|
|
381
364
|
|
|
@@ -418,7 +401,6 @@ describe("$animate", () => {
|
|
|
418
401
|
$animate.removeClass(element, "test-class1");
|
|
419
402
|
$animate.addClass(element, "test-class2");
|
|
420
403
|
$animate.setClass(element, "test-class3", "test-class4");
|
|
421
|
-
$rootScope.$digest();
|
|
422
404
|
expect(element[0].classList.contains("test-class1")).toBeFalse();
|
|
423
405
|
expect(element[0].classList.contains("test-class2")).toBeTrue();
|
|
424
406
|
expect(element[0].classList.contains("test-class3")).toBeTrue();
|
|
@@ -443,7 +425,6 @@ describe("$animate", () => {
|
|
|
443
425
|
$animate.addClass(element, "test1");
|
|
444
426
|
$animate.removeClass(element, "test2");
|
|
445
427
|
|
|
446
|
-
$rootScope.$digest();
|
|
447
428
|
element = JQLite('<p class="test4">test</p>');
|
|
448
429
|
|
|
449
430
|
$rootScope.$apply(() => {
|
|
@@ -486,8 +467,6 @@ describe("$animate", () => {
|
|
|
486
467
|
$animate.addClass(target, "test-class2");
|
|
487
468
|
$animate.setClass(target, "test-class3", "test-class4");
|
|
488
469
|
|
|
489
|
-
$rootScope.$digest();
|
|
490
|
-
|
|
491
470
|
expect(target[0].classList.contains("test-class2")).toBeTrue();
|
|
492
471
|
expect(target[0].classList.contains("test-class3")).toBeTrue();
|
|
493
472
|
});
|
|
@@ -203,7 +203,7 @@ export function AnimationProvider() {
|
|
|
203
203
|
// were apart of the same postDigest flush call.
|
|
204
204
|
if (animationQueue.length > 1) return runner;
|
|
205
205
|
|
|
206
|
-
$rootScope
|
|
206
|
+
$rootScope.$postUpdate(() => {
|
|
207
207
|
const animations = [];
|
|
208
208
|
animationQueue.forEach((entry) => {
|
|
209
209
|
// the element was destroyed early on which removed the runner
|
package/src/binding.spec.js
CHANGED
package/src/core/cache/cache.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export const EXPANDO = "
|
|
10
|
+
export const EXPANDO = "ng";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Expando cache for adding properties to DOM nodes with JavaScript.
|
|
@@ -17,31 +17,4 @@ export const EXPANDO = "ngId";
|
|
|
17
17
|
*
|
|
18
18
|
* @type {Map<number, ExpandoStore>}
|
|
19
19
|
*/
|
|
20
|
-
export const CACHE = new
|
|
21
|
-
get(target, prop, receiver) {
|
|
22
|
-
if (prop === "size") {
|
|
23
|
-
return target.size;
|
|
24
|
-
}
|
|
25
|
-
if (typeof target[prop] === "function") {
|
|
26
|
-
return function (...args) {
|
|
27
|
-
return target[prop].apply(target, args);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return Reflect.get(target, prop, receiver);
|
|
31
|
-
},
|
|
32
|
-
set(target, prop, value, receiver) {
|
|
33
|
-
return Reflect.set(target, prop, value, receiver);
|
|
34
|
-
},
|
|
35
|
-
deleteProperty(target, prop) {
|
|
36
|
-
return Reflect.deleteProperty(target, prop);
|
|
37
|
-
},
|
|
38
|
-
has(target, prop) {
|
|
39
|
-
return Reflect.has(target, prop);
|
|
40
|
-
},
|
|
41
|
-
ownKeys(target) {
|
|
42
|
-
return Reflect.ownKeys(target);
|
|
43
|
-
},
|
|
44
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
45
|
-
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
46
|
-
},
|
|
47
|
-
});
|
|
20
|
+
export const CACHE = new Map();
|
|
@@ -549,7 +549,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
549
549
|
// When changes occur, the call to trigger their hooks will be added to this queue
|
|
550
550
|
let onChangesQueue;
|
|
551
551
|
|
|
552
|
-
// This function is called in a
|
|
552
|
+
// This function is called in a $postUpdate to trigger all the onChanges hooks in a single digest
|
|
553
553
|
function flushOnChangesQueue() {
|
|
554
554
|
try {
|
|
555
555
|
if (!--ttl) {
|
|
@@ -561,7 +561,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
561
561
|
ttl,
|
|
562
562
|
);
|
|
563
563
|
}
|
|
564
|
-
// We must run this hook in an apply since the
|
|
564
|
+
// We must run this hook in an apply since the $postUpdate runs outside apply
|
|
565
565
|
$rootScope.$apply(() => {
|
|
566
566
|
for (let i = 0, ii = onChangesQueue.length; i < ii; ++i) {
|
|
567
567
|
try {
|
|
@@ -906,7 +906,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
906
906
|
containingScope,
|
|
907
907
|
) {
|
|
908
908
|
if (!transcludedScope) {
|
|
909
|
-
transcludedScope = scope.$
|
|
909
|
+
transcludedScope = scope.$transcluded(containingScope);
|
|
910
910
|
transcludedScope.$$transcluded = true;
|
|
911
911
|
}
|
|
912
912
|
|
|
@@ -1336,7 +1336,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1336
1336
|
const controller = elementControllers[name];
|
|
1337
1337
|
const bindings = controllerDirective.$$bindings.bindToController;
|
|
1338
1338
|
|
|
1339
|
-
controller.instance = controller();
|
|
1339
|
+
controller.instance = controllerScope.$new(controller());
|
|
1340
1340
|
$element.data(
|
|
1341
1341
|
`$${controllerDirective.name}Controller`,
|
|
1342
1342
|
controller.instance,
|
|
@@ -2457,15 +2457,12 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2457
2457
|
if (interpolateFn) {
|
|
2458
2458
|
directives.push({
|
|
2459
2459
|
priority: 0,
|
|
2460
|
-
compile:
|
|
2461
|
-
|
|
2462
|
-
// we don't have a parent and thus need to add the class during linking fn.
|
|
2460
|
+
compile: () => (scope, node, arg1, arg3) => {
|
|
2461
|
+
let current = JQLite(node).controller();
|
|
2463
2462
|
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
});
|
|
2468
|
-
};
|
|
2463
|
+
node[0].nodeValue = interpolateFn(current || scope, (val) => {
|
|
2464
|
+
node[0].nodeValue = val;
|
|
2465
|
+
});
|
|
2469
2466
|
},
|
|
2470
2467
|
});
|
|
2471
2468
|
}
|
|
@@ -2985,21 +2982,23 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2985
2982
|
destination[scopeName],
|
|
2986
2983
|
);
|
|
2987
2984
|
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
if (
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2985
|
+
scope.attrs = attrs;
|
|
2986
|
+
removeWatch = scope.$watch(
|
|
2987
|
+
`attrs.${attrName}`,
|
|
2988
|
+
(newValue, oldValue) => {
|
|
2989
|
+
if (oldValue === newValue) {
|
|
2990
|
+
if (
|
|
2991
|
+
oldValue === initialValue ||
|
|
2992
|
+
(isLiteral && equals(oldValue, initialValue))
|
|
2993
|
+
) {
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
oldValue = initialValue;
|
|
2997
2997
|
}
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
});
|
|
2998
|
+
recordChanges(scopeName, newValue, oldValue);
|
|
2999
|
+
destination[scopeName] = newValue;
|
|
3000
|
+
},
|
|
3001
|
+
);
|
|
3003
3002
|
|
|
3004
3003
|
removeWatchCollection.push(removeWatch);
|
|
3005
3004
|
break;
|
|
@@ -3034,7 +3033,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
3034
3033
|
) {
|
|
3035
3034
|
// If we have not already scheduled the top level onChangesQueue handler then do so now
|
|
3036
3035
|
if (!onChangesQueue) {
|
|
3037
|
-
scope
|
|
3036
|
+
scope.$postUpdate(flushOnChangesQueue);
|
|
3038
3037
|
onChangesQueue = [];
|
|
3039
3038
|
}
|
|
3040
3039
|
// If we have not already queued a trigger of onChanges for this controller then do so now
|