@angular-wave/angular.ts 0.0.70 → 0.0.72
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.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-children-directive.md +1 -1
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-css.html +2 -2
- package/src/animations/animate-js.html +1 -1
- package/src/animations/animate-queue.js +4 -4
- package/src/animations/animate-swap.md +1 -1
- package/src/{core/animate → animations}/animate.html +1 -1
- package/src/{core/animate → animations}/animate.js +4 -120
- package/src/animations/raf-scheduler.js +7 -3
- package/src/animations/raf-scheduler.spec.js +3 -3
- package/src/animations/shared.js +16 -7
- package/src/binding.spec.js +4 -3
- package/src/core/compile/attributes.js +326 -0
- package/src/core/compile/compile.js +76 -433
- package/src/core/compile/compile.spec.js +45 -28
- package/src/core/di/injector.md +1 -1
- package/src/core/di/ng-module.js +46 -3
- package/src/core/interpolate/interpolate.js +1 -12
- package/src/core/location/location.js +26 -4
- package/src/core/parser/parse.js +50 -47
- package/src/core/prop.spec.js +15 -11
- package/src/core/scope/scope.js +4 -7
- package/src/directive/bind/bind.spec.js +80 -44
- package/src/directive/class/class.js +43 -14
- package/src/directive/class/class.spec.js +7 -4
- package/src/directive/form/form.js +3 -1
- package/src/directive/form/form.spec.js +3 -4
- package/src/directive/if/if-animate-css.html +5 -7
- package/src/directive/if/if.js +1 -1
- package/src/directive/if/if.spec.js +3 -2
- package/src/directive/include/include.js +1 -1
- package/src/directive/input/input.spec.js +6 -4
- package/src/directive/list/list.spec.js +4 -2
- package/src/directive/messages/messages.js +5 -4
- package/src/directive/messages/messages.spec.js +4 -4
- package/src/directive/model/model.spec.js +4 -3
- package/src/directive/model-options/model-options.spec.js +3 -1
- package/src/directive/repeat/repeat.md +1 -1
- package/src/directive/repeat/repeat.spec.js +1 -1
- package/src/directive/select/select.spec.js +3 -3
- package/src/directive/show-hide/show-hide.js +36 -6
- package/src/directive/switch/switch.spec.js +5 -2
- package/src/directive/validators/validators.spec.js +6 -4
- package/src/loader.js +1 -2
- package/src/public.js +22 -10
- package/src/router/state/state-object.js +4 -9
- package/src/router/url/url-matcher.js +1 -1
- package/src/router/url/url-rule.js +5 -1
- package/src/router/url/url-service.js +1 -1
- package/src/services/anchor-scroll.html +1 -1
- package/src/shared/jqlite/jqlite.js +14 -2
- package/src/types.js +1 -1
- package/types/animations/animate-css-driver.d.ts +1 -1
- package/types/animations/animate-queue.d.ts +1 -2
- package/types/{core/animate → animations}/animate.d.ts +2 -12
- package/types/animations/raf-scheduler.d.ts +7 -2
- package/types/animations/shared.d.ts +11 -6
- package/types/core/compile/attributes.d.ts +101 -0
- package/types/core/compile/compile.d.ts +10 -67
- package/types/core/di/ng-module.d.ts +55 -12
- package/types/core/interpolate/interpolate.d.ts +1 -12
- package/types/core/location/location.d.ts +12 -2
- package/types/core/parser/parse.d.ts +10 -10
- package/types/core/scope/scope.d.ts +20 -20
- package/types/directive/form/form.d.ts +2 -11
- package/types/router/state/state-object.d.ts +0 -2
- package/types/router/url/url-matcher.d.ts +2 -2
- package/types/router/url/url-rule.d.ts +2 -1
- package/types/shared/jqlite/jqlite.d.ts +10 -6
- package/types/types.d.ts +1 -1
- package/src/animations/module.js +0 -25
- package/src/core/animate/animate-css.js +0 -88
- package/src/core/animate/anomate.md +0 -13
- package/types/animations/module.d.ts +0 -1
- package/types/core/animate/animate-css.d.ts +0 -19
- /package/src/{core/animate → animations}/animate-runner.js +0 -0
- /package/src/{core/animate → animations}/animate.spec.js +0 -0
- /package/src/{core/animate → animations}/helpers.js +0 -0
- /package/types/{core/animate → animations}/animate-runner.d.ts +0 -0
- /package/types/{core/animate → animations}/helpers.d.ts +0 -0
|
@@ -58,12 +58,15 @@ describe("$compile", () => {
|
|
|
58
58
|
$sce;
|
|
59
59
|
|
|
60
60
|
beforeEach(() => {
|
|
61
|
+
dealoc(document.getElementById("dummy"));
|
|
61
62
|
log = [];
|
|
62
63
|
window.angular = new Angular();
|
|
63
64
|
module = window.angular.module("test1", ["ng"]);
|
|
64
65
|
defaultModule = window.angular.module("defaultModule", ["ng"]);
|
|
65
66
|
myModule = window.angular.module("myModule", ["ng"]);
|
|
66
|
-
injector =
|
|
67
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
68
|
+
"defaultModule",
|
|
69
|
+
]);
|
|
67
70
|
$rootScope = injector.get("$rootScope");
|
|
68
71
|
$compile = injector.get("$compile");
|
|
69
72
|
$templateCache = injector.get("$templateCache");
|
|
@@ -177,7 +180,10 @@ describe("$compile", () => {
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
function initInjector(name) {
|
|
180
|
-
|
|
183
|
+
dealoc(document.getElementById("dummy"));
|
|
184
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
185
|
+
name,
|
|
186
|
+
]);
|
|
181
187
|
reloadInjector();
|
|
182
188
|
}
|
|
183
189
|
|
|
@@ -7496,15 +7502,15 @@ describe("$compile", () => {
|
|
|
7496
7502
|
},
|
|
7497
7503
|
}),
|
|
7498
7504
|
);
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
(
|
|
7505
|
+
dealoc(document.getElementById("dummy"));
|
|
7506
|
+
window.angular
|
|
7507
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
7508
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_, _$sce_) => {
|
|
7502
7509
|
$compile = _$compile_;
|
|
7503
7510
|
$rootScope = _$rootScope_;
|
|
7504
7511
|
$templateCache = _$templateCache_;
|
|
7505
7512
|
$sce = _$sce_;
|
|
7506
|
-
}
|
|
7507
|
-
);
|
|
7513
|
+
});
|
|
7508
7514
|
});
|
|
7509
7515
|
|
|
7510
7516
|
it("should compile and link both attribute and text bindings", () => {
|
|
@@ -9730,10 +9736,13 @@ describe("$compile", () => {
|
|
|
9730
9736
|
template: "1:{{param1}};2:{{param2}};3:{{::param1}};4:{{::param2}}",
|
|
9731
9737
|
}));
|
|
9732
9738
|
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9739
|
+
dealoc(document.getElementById("dummy"));
|
|
9740
|
+
window.angular
|
|
9741
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9742
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
9743
|
+
$compile = _$compile_;
|
|
9744
|
+
$rootScope = _$rootScope_;
|
|
9745
|
+
});
|
|
9737
9746
|
|
|
9738
9747
|
element = $compile(
|
|
9739
9748
|
'<div other-tpl-dir param1="::foo" param2="bar"></div>',
|
|
@@ -9765,10 +9774,13 @@ describe("$compile", () => {
|
|
|
9765
9774
|
template: "1:{{param1}};2:{{param2}};3:{{::param1}};4:{{::param2}}",
|
|
9766
9775
|
}));
|
|
9767
9776
|
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9777
|
+
dealoc(document.getElementById("dummy"));
|
|
9778
|
+
window.angular
|
|
9779
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9780
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
9781
|
+
$compile = _$compile_;
|
|
9782
|
+
$rootScope = _$rootScope_;
|
|
9783
|
+
});
|
|
9772
9784
|
|
|
9773
9785
|
element = $compile(
|
|
9774
9786
|
'<div other-tpl-dir param1="{{::foo}}" param2="{{bar}}"></div>',
|
|
@@ -9800,13 +9812,14 @@ describe("$compile", () => {
|
|
|
9800
9812
|
templateUrl: "other.html",
|
|
9801
9813
|
}));
|
|
9802
9814
|
|
|
9803
|
-
|
|
9804
|
-
|
|
9815
|
+
dealoc(document.getElementById("dummy"));
|
|
9816
|
+
window.angular
|
|
9817
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9818
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
9805
9819
|
$compile = _$compile_;
|
|
9806
9820
|
$rootScope = _$rootScope_;
|
|
9807
9821
|
$templateCache = _$templateCache_;
|
|
9808
|
-
}
|
|
9809
|
-
);
|
|
9822
|
+
});
|
|
9810
9823
|
|
|
9811
9824
|
$templateCache.put(
|
|
9812
9825
|
"other.html",
|
|
@@ -9841,13 +9854,14 @@ describe("$compile", () => {
|
|
|
9841
9854
|
templateUrl: "other.html",
|
|
9842
9855
|
}));
|
|
9843
9856
|
|
|
9844
|
-
|
|
9845
|
-
|
|
9857
|
+
dealoc(document.getElementById("dummy"));
|
|
9858
|
+
window.angular
|
|
9859
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9860
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
9846
9861
|
$compile = _$compile_;
|
|
9847
9862
|
$rootScope = _$rootScope_;
|
|
9848
9863
|
$templateCache = _$templateCache_;
|
|
9849
|
-
}
|
|
9850
|
-
);
|
|
9864
|
+
});
|
|
9851
9865
|
|
|
9852
9866
|
$templateCache.put(
|
|
9853
9867
|
"other.html",
|
|
@@ -16810,15 +16824,16 @@ describe("$compile", () => {
|
|
|
16810
16824
|
});
|
|
16811
16825
|
|
|
16812
16826
|
describe("multi-element directive", () => {
|
|
16813
|
-
it("should group on link function", () => {
|
|
16827
|
+
it("should group on link function", async () => {
|
|
16814
16828
|
$rootScope.show = false;
|
|
16815
16829
|
element = $compile(
|
|
16816
16830
|
"<div>" +
|
|
16817
16831
|
'<span ng-show-start="show"></span>' +
|
|
16818
|
-
"<span ng-show-end></span>" +
|
|
16832
|
+
"<span ng-show-end='show'></span>" +
|
|
16819
16833
|
"</div>",
|
|
16820
16834
|
)($rootScope);
|
|
16821
16835
|
$rootScope.$digest();
|
|
16836
|
+
await wait(100);
|
|
16822
16837
|
const spans = element.find("span");
|
|
16823
16838
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
16824
16839
|
expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
@@ -17121,7 +17136,7 @@ describe("$compile", () => {
|
|
|
17121
17136
|
}).toThrowError(/uterdir/);
|
|
17122
17137
|
});
|
|
17123
17138
|
|
|
17124
|
-
it("should support data- prefix", () => {
|
|
17139
|
+
it("should support data- prefix", async () => {
|
|
17125
17140
|
$rootScope.show = false;
|
|
17126
17141
|
element = $compile(
|
|
17127
17142
|
"<div>" +
|
|
@@ -17132,11 +17147,13 @@ describe("$compile", () => {
|
|
|
17132
17147
|
"</div>",
|
|
17133
17148
|
)($rootScope);
|
|
17134
17149
|
$rootScope.$digest();
|
|
17150
|
+
await wait(100);
|
|
17135
17151
|
const spans = element.find("span");
|
|
17152
|
+
debugger;
|
|
17136
17153
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17137
|
-
expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17154
|
+
//expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17138
17155
|
expect(spans.eq(2)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17139
|
-
expect(spans.eq(3)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17156
|
+
// expect(spans.eq(3)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17140
17157
|
});
|
|
17141
17158
|
});
|
|
17142
17159
|
|
package/src/core/di/injector.md
CHANGED
package/src/core/di/ng-module.js
CHANGED
|
@@ -25,7 +25,6 @@ export const CONTROLLER_LITERAL = "$controllerProvider";
|
|
|
25
25
|
*/
|
|
26
26
|
export class NgModule {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
28
|
* @param {String} name - Name of the module
|
|
30
29
|
* @param {Array<String>} requires - List of modules which the injector will load before the current module
|
|
31
30
|
* @param {Function} [configFn]
|
|
@@ -78,7 +77,7 @@ export class NgModule {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/**
|
|
81
|
-
* @param {
|
|
80
|
+
* @param {string} name
|
|
82
81
|
* @param {any} object
|
|
83
82
|
* @returns {NgModule}
|
|
84
83
|
*/
|
|
@@ -88,7 +87,7 @@ export class NgModule {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
/**
|
|
91
|
-
* @param {
|
|
90
|
+
* @param {string} name
|
|
92
91
|
* @param {any} object
|
|
93
92
|
* @returns {NgModule}
|
|
94
93
|
*/
|
|
@@ -107,11 +106,20 @@ export class NgModule {
|
|
|
107
106
|
return this;
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @param {Function} block
|
|
111
|
+
* @returns {NgModule}
|
|
112
|
+
*/
|
|
110
113
|
run(block) {
|
|
111
114
|
this.runBlocks.push(block);
|
|
112
115
|
return this;
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @param {string} name
|
|
120
|
+
* @param {*} options
|
|
121
|
+
* @returns {NgModule}
|
|
122
|
+
*/
|
|
115
123
|
component(name, options) {
|
|
116
124
|
if (options && isFunction(options)) {
|
|
117
125
|
options.$$moduleName = name;
|
|
@@ -120,6 +128,11 @@ export class NgModule {
|
|
|
120
128
|
return this;
|
|
121
129
|
}
|
|
122
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} name
|
|
133
|
+
* @param {*} providerFunction
|
|
134
|
+
* @returns {NgModule}
|
|
135
|
+
*/
|
|
123
136
|
factory(name, providerFunction) {
|
|
124
137
|
if (providerFunction && isFunction(providerFunction)) {
|
|
125
138
|
providerFunction.$$moduleName = name;
|
|
@@ -132,6 +145,11 @@ export class NgModule {
|
|
|
132
145
|
return this;
|
|
133
146
|
}
|
|
134
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @param {string} name
|
|
150
|
+
* @param {*} serviceFunction
|
|
151
|
+
* @returns {NgModule}
|
|
152
|
+
*/
|
|
135
153
|
service(name, serviceFunction) {
|
|
136
154
|
if (serviceFunction && isFunction(serviceFunction)) {
|
|
137
155
|
serviceFunction.$$moduleName = name;
|
|
@@ -144,6 +162,11 @@ export class NgModule {
|
|
|
144
162
|
return this;
|
|
145
163
|
}
|
|
146
164
|
|
|
165
|
+
/**
|
|
166
|
+
* @param {string} name
|
|
167
|
+
* @param {*} providerType
|
|
168
|
+
* @returns {NgModule}
|
|
169
|
+
*/
|
|
147
170
|
provider(name, providerType) {
|
|
148
171
|
if (providerType && isFunction(providerType)) {
|
|
149
172
|
providerType.$$moduleName = name;
|
|
@@ -152,6 +175,11 @@ export class NgModule {
|
|
|
152
175
|
return this;
|
|
153
176
|
}
|
|
154
177
|
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} name
|
|
180
|
+
* @param {*} decorFn
|
|
181
|
+
* @returns {NgModule}
|
|
182
|
+
*/
|
|
155
183
|
decorator(name, decorFn) {
|
|
156
184
|
if (decorFn && isFunction(decorFn)) {
|
|
157
185
|
decorFn.$$moduleName = name;
|
|
@@ -160,6 +188,11 @@ export class NgModule {
|
|
|
160
188
|
return this;
|
|
161
189
|
}
|
|
162
190
|
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} name
|
|
193
|
+
* @param {*} directiveFactory
|
|
194
|
+
* @returns {NgModule}
|
|
195
|
+
*/
|
|
163
196
|
directive(name, directiveFactory) {
|
|
164
197
|
if (directiveFactory && isFunction(directiveFactory)) {
|
|
165
198
|
directiveFactory.$$moduleName = name;
|
|
@@ -172,6 +205,11 @@ export class NgModule {
|
|
|
172
205
|
return this;
|
|
173
206
|
}
|
|
174
207
|
|
|
208
|
+
/**
|
|
209
|
+
* @param {string} name
|
|
210
|
+
* @param {*} animationFactory
|
|
211
|
+
* @returns {NgModule}
|
|
212
|
+
*/
|
|
175
213
|
animation(name, animationFactory) {
|
|
176
214
|
if (animationFactory && isFunction(animationFactory)) {
|
|
177
215
|
animationFactory.$$moduleName = name;
|
|
@@ -192,6 +230,11 @@ export class NgModule {
|
|
|
192
230
|
return this;
|
|
193
231
|
}
|
|
194
232
|
|
|
233
|
+
/**
|
|
234
|
+
* @param {string} name
|
|
235
|
+
* @param {*} ctlFn
|
|
236
|
+
* @returns {NgModule}
|
|
237
|
+
*/
|
|
195
238
|
controller(name, ctlFn) {
|
|
196
239
|
if (ctlFn && isFunction(ctlFn)) {
|
|
197
240
|
ctlFn.$$moduleName = name;
|
|
@@ -29,11 +29,6 @@ $interpolateMinErr.interr = function (text, err) {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* @ngdoc provider
|
|
33
|
-
* @name $interpolateProvider
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @description
|
|
37
32
|
*
|
|
38
33
|
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
|
|
39
34
|
*
|
|
@@ -50,9 +45,6 @@ export function $InterpolateProvider() {
|
|
|
50
45
|
let endSymbol = "}}";
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
|
-
* @ngdoc method
|
|
54
|
-
* @name $interpolateProvider#startSymbol
|
|
55
|
-
* @description
|
|
56
48
|
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
|
57
49
|
*
|
|
58
50
|
* @param {string=} value new value to set the starting symbol to.
|
|
@@ -67,9 +59,6 @@ export function $InterpolateProvider() {
|
|
|
67
59
|
};
|
|
68
60
|
|
|
69
61
|
/**
|
|
70
|
-
* @ngdoc method
|
|
71
|
-
* @name $interpolateProvider#endSymbol
|
|
72
|
-
* @description
|
|
73
62
|
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
|
74
63
|
*
|
|
75
64
|
* @param {string=} value new value to set the ending symbol to.
|
|
@@ -89,7 +78,7 @@ export function $InterpolateProvider() {
|
|
|
89
78
|
"$sce",
|
|
90
79
|
/**
|
|
91
80
|
*
|
|
92
|
-
* @param {
|
|
81
|
+
* @param {import("../parser/parse").ParseService} $parse
|
|
93
82
|
* @param {import('../exception-handler').ErrorHandler} $exceptionHandler
|
|
94
83
|
* @param {*} $sce
|
|
95
84
|
* @returns
|
|
@@ -333,6 +333,19 @@ export class Location {
|
|
|
333
333
|
|
|
334
334
|
return this;
|
|
335
335
|
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @param {string} _url
|
|
339
|
+
* @param {string} _url2
|
|
340
|
+
* @returns {boolean}
|
|
341
|
+
*/
|
|
342
|
+
$$parseLinkUrl(_url, _url2) {
|
|
343
|
+
throw new Error(`Method not implemented ${_url} ${_url2}`);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
$$parse(_url) {
|
|
347
|
+
throw new Error(`Method not implemented ${_url}`);
|
|
348
|
+
}
|
|
336
349
|
}
|
|
337
350
|
|
|
338
351
|
/**
|
|
@@ -379,7 +392,12 @@ export class LocationHtml5Url extends Location {
|
|
|
379
392
|
return this.appBaseNoFile + url.substr(1); // first char is always '/'
|
|
380
393
|
}
|
|
381
394
|
|
|
382
|
-
|
|
395
|
+
/**
|
|
396
|
+
* @param {string} url
|
|
397
|
+
* @param {string} relHref
|
|
398
|
+
* @returns {boolean}
|
|
399
|
+
*/
|
|
400
|
+
$$parseLinkUrl(url, relHref) {
|
|
383
401
|
if (relHref && relHref[0] === "#") {
|
|
384
402
|
// special case for links to hash fragments:
|
|
385
403
|
// keep the old url and only replace the hash fragment
|
|
@@ -410,7 +428,7 @@ export class LocationHtml5Url extends Location {
|
|
|
410
428
|
this.$$parse(rewrittenUrl);
|
|
411
429
|
}
|
|
412
430
|
return !!rewrittenUrl;
|
|
413
|
-
}
|
|
431
|
+
}
|
|
414
432
|
}
|
|
415
433
|
|
|
416
434
|
/**
|
|
@@ -513,6 +531,10 @@ export class LocationHashbangUrl extends Location {
|
|
|
513
531
|
return this.appBase + (url ? this.hashPrefix + url : "");
|
|
514
532
|
}
|
|
515
533
|
|
|
534
|
+
/**
|
|
535
|
+
* @param {string} url
|
|
536
|
+
* @returns {boolean}
|
|
537
|
+
*/
|
|
516
538
|
$$parseLinkUrl(url) {
|
|
517
539
|
if (stripHash(this.appBase) === stripHash(url)) {
|
|
518
540
|
this.$$parse(url);
|
|
@@ -602,7 +624,7 @@ export function $LocationProvider() {
|
|
|
602
624
|
let $location;
|
|
603
625
|
let LocationMode;
|
|
604
626
|
const baseHref = $browser.baseHref(); // if base[href] is undefined, it defaults to ''
|
|
605
|
-
const initialUrl = $browser.url();
|
|
627
|
+
const initialUrl = /** @type {string} */ ($browser.url());
|
|
606
628
|
let appBase;
|
|
607
629
|
|
|
608
630
|
if (html5Mode.enabled) {
|
|
@@ -639,7 +661,7 @@ export function $LocationProvider() {
|
|
|
639
661
|
$location.$$state = $browser.state();
|
|
640
662
|
} catch (e) {
|
|
641
663
|
// Restore old values if pushState fails
|
|
642
|
-
$location.url(oldUrl);
|
|
664
|
+
$location.url(/** @type {string} */ (oldUrl));
|
|
643
665
|
$location.$$state = oldState;
|
|
644
666
|
|
|
645
667
|
throw e;
|
package/src/core/parser/parse.js
CHANGED
|
@@ -7,11 +7,11 @@ import { Parser } from "./parser";
|
|
|
7
7
|
* @typedef {Object} CompiledExpressionProps
|
|
8
8
|
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
9
9
|
* @property {boolean} constant - Indicates if the expression is constant.
|
|
10
|
-
* @property {boolean} isPure
|
|
10
|
+
* @property {boolean} [isPure]
|
|
11
11
|
* @property {boolean} oneTime
|
|
12
|
-
* @property {function(import('../scope/scope').Scope, import('../scope/scope').WatchListener, boolean, CompiledExpression, string | ((scope: import('../scope/scope').Scope) => any)): any} $$watchDelegate
|
|
13
|
-
* @property {any[]} inputs
|
|
14
|
-
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|
|
12
|
+
* @property {function(import('../scope/scope').Scope, import('../scope/scope').WatchListener, boolean, CompiledExpression, string | ((scope: import('../scope/scope').Scope) => any) | CompiledExpression): any} [$$watchDelegate]
|
|
13
|
+
* @property {any[]|Function} inputs
|
|
14
|
+
* @property {function(any, any): any} [assign] - Assigns a value to a context. If value is not provided,
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -30,7 +30,7 @@ import { Parser } from "./parser";
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @typedef {function(string|function(import('../scope/scope').Scope):any, function(any, import('../scope/scope').Scope, any):any=, boolean=): CompiledExpression} ParseService
|
|
33
|
+
* @typedef {function(CompiledExpression|string|function(import('../scope/scope').Scope):any, function(any, import('../scope/scope').Scope, any):any=, boolean=): CompiledExpression} ParseService
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
export function $ParseProvider() {
|
|
@@ -219,21 +219,22 @@ function inputsWatchDelegate(
|
|
|
219
219
|
objectEquality,
|
|
220
220
|
parsedExpression,
|
|
221
221
|
) {
|
|
222
|
-
let inputExpressions = parsedExpression.inputs;
|
|
222
|
+
let inputExpressions = /** @type {Function} */ (parsedExpression.inputs);
|
|
223
223
|
let lastResult;
|
|
224
224
|
|
|
225
225
|
if (inputExpressions.length === 1) {
|
|
226
226
|
let oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
let inputExpression = inputExpressions[0];
|
|
229
|
+
|
|
229
230
|
return scope.$watch(
|
|
230
231
|
($scope) => {
|
|
231
|
-
const newInputValue =
|
|
232
|
+
const newInputValue = inputExpression($scope);
|
|
232
233
|
if (
|
|
233
234
|
!expressionInputDirtyCheck(
|
|
234
235
|
newInputValue,
|
|
235
236
|
oldInputValueOf,
|
|
236
|
-
|
|
237
|
+
inputExpression.isPure,
|
|
237
238
|
)
|
|
238
239
|
) {
|
|
239
240
|
lastResult = parsedExpression($scope, undefined, undefined, [
|
|
@@ -246,48 +247,49 @@ function inputsWatchDelegate(
|
|
|
246
247
|
listener,
|
|
247
248
|
objectEquality,
|
|
248
249
|
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return scope.$watch(
|
|
259
|
-
(scope) => {
|
|
260
|
-
let changed = false;
|
|
250
|
+
} else {
|
|
251
|
+
const oldInputValueOfValues = [];
|
|
252
|
+
const oldInputValues = [];
|
|
253
|
+
for (let i = 0, ii = inputExpressions.length; i < ii; i++) {
|
|
254
|
+
oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails
|
|
255
|
+
oldInputValues[i] = null;
|
|
256
|
+
}
|
|
261
257
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
258
|
+
return scope.$watch(
|
|
259
|
+
(scope) => {
|
|
260
|
+
let changed = false;
|
|
261
|
+
|
|
262
|
+
for (let i = 0, ii = inputExpressions.length; i < ii; i++) {
|
|
263
|
+
const newInputValue = inputExpressions[i](scope);
|
|
264
|
+
if (
|
|
265
|
+
changed ||
|
|
266
|
+
(changed = !expressionInputDirtyCheck(
|
|
267
|
+
newInputValue,
|
|
268
|
+
oldInputValueOfValues[i],
|
|
269
|
+
inputExpressions[i].isPure,
|
|
270
|
+
))
|
|
271
|
+
) {
|
|
272
|
+
oldInputValues[i] = newInputValue;
|
|
273
|
+
oldInputValueOfValues[i] =
|
|
274
|
+
newInputValue && getValueOf(newInputValue);
|
|
275
|
+
}
|
|
274
276
|
}
|
|
275
|
-
}
|
|
276
277
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
if (changed) {
|
|
279
|
+
lastResult = parsedExpression(
|
|
280
|
+
scope,
|
|
281
|
+
undefined,
|
|
282
|
+
undefined,
|
|
283
|
+
oldInputValues,
|
|
284
|
+
);
|
|
285
|
+
}
|
|
285
286
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
return lastResult;
|
|
288
|
+
},
|
|
289
|
+
listener,
|
|
290
|
+
objectEquality,
|
|
291
|
+
);
|
|
292
|
+
}
|
|
291
293
|
}
|
|
292
294
|
|
|
293
295
|
function oneTimeWatchDelegate(
|
|
@@ -311,6 +313,7 @@ function oneTimeWatchDelegate(
|
|
|
311
313
|
oneTimeWatch.literal = parsedExpression.literal;
|
|
312
314
|
oneTimeWatch.constant = parsedExpression.constant;
|
|
313
315
|
oneTimeWatch.inputs = parsedExpression.inputs;
|
|
316
|
+
oneTimeWatch.oneTime = undefined;
|
|
314
317
|
|
|
315
318
|
// Allow other delegates to run on this wrapped expression
|
|
316
319
|
addWatchDelegate(oneTimeWatch);
|
package/src/core/prop.spec.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Angular } from "../loader";
|
|
2
2
|
import { createInjector } from "./di/injector";
|
|
3
3
|
import { valueFn } from "../shared/utils";
|
|
4
|
+
import { dealoc } from "../shared/jqlite/jqlite";
|
|
4
5
|
|
|
5
6
|
fdescribe("ngProp*", () => {
|
|
6
7
|
let $compile, $rootScope, compileProvider, $sce;
|
|
@@ -18,7 +19,7 @@ fdescribe("ngProp*", () => {
|
|
|
18
19
|
};
|
|
19
20
|
});
|
|
20
21
|
|
|
21
|
-
let injector =
|
|
22
|
+
let injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
22
23
|
"myModule",
|
|
23
24
|
function ($compileProvider) {
|
|
24
25
|
compileProvider = $compileProvider;
|
|
@@ -617,16 +618,19 @@ fdescribe("ngProp*", () => {
|
|
|
617
618
|
describe("*[innerHTML]", () => {
|
|
618
619
|
describe("SCE disabled", () => {
|
|
619
620
|
beforeEach(() => {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
$
|
|
629
|
-
|
|
621
|
+
dealoc(document.getElementById("dummy"));
|
|
622
|
+
window.angular
|
|
623
|
+
.bootstrap(document.getElementById("dummy"), [
|
|
624
|
+
"myModule",
|
|
625
|
+
($sceProvider) => {
|
|
626
|
+
$sceProvider.enabled(false);
|
|
627
|
+
},
|
|
628
|
+
])
|
|
629
|
+
.invoke((_$compile_, _$rootScope_, _$sce_) => {
|
|
630
|
+
$compile = _$compile_;
|
|
631
|
+
$rootScope = _$rootScope_;
|
|
632
|
+
$sce = _$sce_;
|
|
633
|
+
});
|
|
630
634
|
});
|
|
631
635
|
|
|
632
636
|
it("should set html", () => {
|
package/src/core/scope/scope.js
CHANGED
|
@@ -386,7 +386,7 @@ export class Scope {
|
|
|
386
386
|
*
|
|
387
387
|
*
|
|
388
388
|
*
|
|
389
|
-
* @param {string | ((scope: Scope) => any)} watchExp Expression that is evaluated on each
|
|
389
|
+
* @param {string | ((scope: Scope) => any) | import("../parser/parse").CompiledExpression} watchExp Expression that is evaluated on each
|
|
390
390
|
* {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
|
|
391
391
|
* a call to the `listener`.
|
|
392
392
|
*
|
|
@@ -1074,12 +1074,8 @@ export class Scope {
|
|
|
1074
1074
|
this.$$nextSibling.$$prevSibling = this.$$prevSibling;
|
|
1075
1075
|
|
|
1076
1076
|
// Disable listeners, watchers and apply/digest methods
|
|
1077
|
-
this.$destroy =
|
|
1078
|
-
|
|
1079
|
-
this.$apply =
|
|
1080
|
-
this.$evalAsync =
|
|
1081
|
-
this.$applyAsync =
|
|
1082
|
-
() => {};
|
|
1077
|
+
this.$destroy = this.$digest = this.$apply = this.$applyAsync = () => {};
|
|
1078
|
+
this.$evalAsync = () => undefined;
|
|
1083
1079
|
this.$on =
|
|
1084
1080
|
this.$watch =
|
|
1085
1081
|
this.$watchGroup =
|
|
@@ -1358,6 +1354,7 @@ export class Scope {
|
|
|
1358
1354
|
* @param {string} name
|
|
1359
1355
|
*/
|
|
1360
1356
|
decrementListenerCount(count, name) {
|
|
1357
|
+
/** @type {Scope} */
|
|
1361
1358
|
let self = this;
|
|
1362
1359
|
for (; self; self = self.$parent) {
|
|
1363
1360
|
if (self.$$listenerCount[name] !== undefined) {
|