@angular-wave/angular.ts 0.0.48 → 0.0.50
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/Makefile +3 -0
- package/README.md +1 -1
- package/css/angular.css +0 -6
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/jsdoc.json +24 -0
- package/package.json +6 -2
- package/src/core/compile/compile.md +1 -1
- package/src/core/compile/compile.spec.js +50 -48
- package/src/core/interpolate/interpolate.js +1 -18
- package/src/core/on.spec.js +7 -12
- package/src/core/parser/ast.js +234 -69
- package/src/core/parser/interpreter.js +246 -50
- package/src/core/parser/lexer.js +144 -57
- package/src/core/parser/parse.js +38 -278
- package/src/core/parser/parse.md +44 -0
- package/src/core/parser/parser.js +32 -6
- package/src/core/parser/shared.js +7 -1
- package/src/core/prop.spec.js +4 -4
- package/src/core/scope/scope.js +14 -10
- package/src/directive/csp.md +0 -26
- package/src/directive/form/form.spec.js +18 -18
- package/src/directive/include/include.spec.js +18 -18
- package/src/directive/switch/switch.spec.js +4 -4
- package/src/shared/constants.js +3 -2
- package/src/shared/jqlite/jqlite.js +2 -2
- package/src/types.js +4 -1
- package/types/core/parser/ast.d.ts +269 -67
- package/types/core/parser/interpreter.d.ts +202 -53
- package/types/core/parser/lexer.d.ts +153 -0
- package/types/core/parser/parse.d.ts +23 -34
- package/types/core/parser/parser.d.ts +43 -14
- package/types/core/parser/shared.d.ts +7 -1
- package/types/core/scope/scope.d.ts +11 -11
- package/types/shared/jqlite/jqlite.d.ts +4 -4
- package/types/types.d.ts +1 -1
- package/src/core/parser/compiler.js +0 -561
- package/types/core/parser/compiler.d.ts +0 -49
package/src/core/scope/scope.js
CHANGED
|
@@ -55,7 +55,7 @@ let lastDirtyWatch = null;
|
|
|
55
55
|
let applyAsyncId = null;
|
|
56
56
|
|
|
57
57
|
/** Services required by each scope instance */
|
|
58
|
-
/** @type {
|
|
58
|
+
/** @type {import('../parser/parse').ParseService} */
|
|
59
59
|
let $parse;
|
|
60
60
|
/** @type {import('../../services/browser').Browser} */
|
|
61
61
|
let $browser;
|
|
@@ -89,7 +89,7 @@ export class $RootScopeProvider {
|
|
|
89
89
|
"$browser",
|
|
90
90
|
/**
|
|
91
91
|
* @param {import('../exception-handler').ErrorHandler} exceptionHandler
|
|
92
|
-
* @param {
|
|
92
|
+
* @param {import('../parser/parse').ParseService} parse
|
|
93
93
|
* @param {import('../../services/browser').Browser} browser
|
|
94
94
|
* @returns {Scope} root scope
|
|
95
95
|
*/
|
|
@@ -148,7 +148,7 @@ export class Scope {
|
|
|
148
148
|
this.$root = this;
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
* @type {
|
|
151
|
+
* @type {Array<any>}
|
|
152
152
|
*/
|
|
153
153
|
this.$$watchers = [];
|
|
154
154
|
|
|
@@ -263,7 +263,7 @@ export class Scope {
|
|
|
263
263
|
if (isolate || parent !== this) {
|
|
264
264
|
child.$on(
|
|
265
265
|
"$destroy",
|
|
266
|
-
/** @param {
|
|
266
|
+
/** @param {any} $event */ //angular.IAngularEvent
|
|
267
267
|
($event) => {
|
|
268
268
|
$event.currentScope.$$destroyed = true;
|
|
269
269
|
},
|
|
@@ -440,10 +440,10 @@ export class Scope {
|
|
|
440
440
|
* values are examined for changes on every call to `$digest`.
|
|
441
441
|
* - The `listener` is called whenever any expression in the `watchExpressions` array changes.
|
|
442
442
|
*
|
|
443
|
-
* @param {Array.<string|
|
|
443
|
+
* @param {Array.<string|((Scope)=>any)>} watchExpressions Array of expressions that will be individually
|
|
444
444
|
* watched using {@link ng.$rootScope.Scope#$watch $watch()}
|
|
445
445
|
*
|
|
446
|
-
* @param {function(
|
|
446
|
+
* @param {function(any, any, Scope): any} listener Callback called whenever the return value of any
|
|
447
447
|
* expression in `watchExpressions` changes
|
|
448
448
|
* The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
|
|
449
449
|
* those of `watchExpression`
|
|
@@ -533,12 +533,12 @@ export class Scope {
|
|
|
533
533
|
*
|
|
534
534
|
*
|
|
535
535
|
*
|
|
536
|
-
* @param {string|function(
|
|
536
|
+
* @param {string|function(Scope):any} obj Evaluated as {@link guide/expression expression}. The
|
|
537
537
|
* expression value should evaluate to an object or an array which is observed on each
|
|
538
538
|
* {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
|
|
539
539
|
* collection will trigger a call to the `listener`.
|
|
540
540
|
*
|
|
541
|
-
* @param {function(
|
|
541
|
+
* @param {function(any[], any[], Scope):any} listener a callback function called
|
|
542
542
|
* when a change is detected.
|
|
543
543
|
* - The `newCollection` object is the newly modified data obtained from the `obj` expression
|
|
544
544
|
* - The `oldCollection` object is a copy of the former collection data.
|
|
@@ -1309,7 +1309,7 @@ export class Scope {
|
|
|
1309
1309
|
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
|
|
1310
1310
|
*
|
|
1311
1311
|
* @param {string} name Event name to listen on.
|
|
1312
|
-
* @param {function(
|
|
1312
|
+
* @param {function(any): any} listener Function to call when the event is emitted witn angular.IAngularEvent
|
|
1313
1313
|
* @returns {function()} Returns a deregistration function for this listener.
|
|
1314
1314
|
*/
|
|
1315
1315
|
$on(name, listener) {
|
|
@@ -1319,6 +1319,7 @@ export class Scope {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
namedListeners.push(listener);
|
|
1321
1321
|
|
|
1322
|
+
/** @type {Scope} */
|
|
1322
1323
|
let current = this;
|
|
1323
1324
|
do {
|
|
1324
1325
|
current.$$listenerCount[name] = (current.$$listenerCount[name] ?? 0) + 1;
|
|
@@ -1389,6 +1390,7 @@ export class Scope {
|
|
|
1389
1390
|
$emit(name, ...args) {
|
|
1390
1391
|
const empty = [];
|
|
1391
1392
|
let namedListeners;
|
|
1393
|
+
/** @type {Scope} */
|
|
1392
1394
|
let scope = this;
|
|
1393
1395
|
let stopPropagation = false;
|
|
1394
1396
|
const event = {
|
|
@@ -1429,7 +1431,7 @@ export class Scope {
|
|
|
1429
1431
|
break;
|
|
1430
1432
|
}
|
|
1431
1433
|
// traverse upwards
|
|
1432
|
-
scope = scope.$parent;
|
|
1434
|
+
scope = /** @type {Scope} */ scope.$parent;
|
|
1433
1435
|
} while (scope);
|
|
1434
1436
|
|
|
1435
1437
|
event.currentScope = null;
|
|
@@ -1460,8 +1462,10 @@ export class Scope {
|
|
|
1460
1462
|
*/
|
|
1461
1463
|
$broadcast(name, ...args) {
|
|
1462
1464
|
const target = this;
|
|
1465
|
+
/** @type {Scope} */
|
|
1463
1466
|
let current = target;
|
|
1464
1467
|
|
|
1468
|
+
/** @type {Scope} */
|
|
1465
1469
|
let next = target;
|
|
1466
1470
|
const event = {
|
|
1467
1471
|
name,
|
package/src/directive/csp.md
CHANGED
|
@@ -18,12 +18,6 @@
|
|
|
18
18
|
-
|
|
19
19
|
- The following default rules in CSP affect AngularJS:
|
|
20
20
|
-
|
|
21
|
-
- - The use of `eval()`, `Function(string)` and similar functions to dynamically create and execute
|
|
22
|
-
- code from strings is forbidden. AngularJS makes use of this in the {@link $parse} service to
|
|
23
|
-
- provide a 30% increase in the speed of evaluating AngularJS expressions. (This CSP rule can be
|
|
24
|
-
- disabled with the CSP keyword `unsafe-eval`, but it is generally not recommended as it would
|
|
25
|
-
- weaken the protections offered by CSP.)
|
|
26
|
-
-
|
|
27
21
|
- - The use of inline resources, such as inline `<script>` and `<style>` elements, are forbidden.
|
|
28
22
|
- This prevents apps from injecting custom styles directly into the document. AngularJS makes use of
|
|
29
23
|
- this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}). To make these
|
|
@@ -31,22 +25,6 @@
|
|
|
31
25
|
- in your HTML manually. (This CSP rule can be disabled with the CSP keyword `unsafe-inline`, but
|
|
32
26
|
- it is generally not recommended as it would weaken the protections offered by CSP.)
|
|
33
27
|
-
|
|
34
|
-
- If you do not provide `ngCsp` then AngularJS tries to autodetect if CSP is blocking dynamic code
|
|
35
|
-
- creation from strings (e.g., `unsafe-eval` not specified in CSP header) and automatically
|
|
36
|
-
- deactivates this feature in the {@link $parse} service. This autodetection, however, triggers a
|
|
37
|
-
- CSP error to be logged in the console:
|
|
38
|
-
-
|
|
39
|
-
- ```
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
- Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
|
|
44
|
-
- script in the following Content Security Policy directive: "default-src 'self'". Note that
|
|
45
|
-
- 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
|
|
46
|
-
- ```
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
28
|
-
|
|
51
29
|
- This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
|
|
52
30
|
- directive on an element of the HTML document that appears before the `<script>` tag that loads
|
|
@@ -59,7 +37,6 @@
|
|
|
59
37
|
-
|
|
60
38
|
- - no-inline-style: this stops AngularJS from injecting CSS styles into the DOM
|
|
61
39
|
-
|
|
62
|
-
- - no-unsafe-eval: this stops AngularJS from optimizing $parse with unsafe eval of strings
|
|
63
40
|
-
|
|
64
41
|
- You can use these values in the following combinations:
|
|
65
42
|
-
|
|
@@ -72,9 +49,6 @@
|
|
|
72
49
|
- styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous
|
|
73
50
|
- versions of AngularJS.
|
|
74
51
|
-
|
|
75
|
-
- - Specifying only `no-unsafe-eval` tells AngularJS that we must not use eval, but that we can
|
|
76
|
-
- inject inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
|
|
77
|
-
-
|
|
78
52
|
- - Specifying only `no-inline-style` tells AngularJS that we must not inject styles, but that we can
|
|
79
53
|
- run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
|
|
80
54
|
-
|
|
@@ -523,12 +523,12 @@ describe("form", () => {
|
|
|
523
523
|
describe("nested forms", () => {
|
|
524
524
|
it("should chain nested forms", () => {
|
|
525
525
|
doc = JQLite(
|
|
526
|
-
'<ng
|
|
527
|
-
'<ng
|
|
528
|
-
'<input ng
|
|
529
|
-
'<input ng
|
|
530
|
-
"</ng
|
|
531
|
-
"</ng
|
|
526
|
+
'<ng-form name="parent">' +
|
|
527
|
+
'<ng-form name="child">' +
|
|
528
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
529
|
+
'<input ng-model="modelB" name="inputB">' +
|
|
530
|
+
"</ng-form>" +
|
|
531
|
+
"</ng-form>",
|
|
532
532
|
);
|
|
533
533
|
$compile(doc)(scope);
|
|
534
534
|
|
|
@@ -561,8 +561,8 @@ describe("form", () => {
|
|
|
561
561
|
doc = JQLite(
|
|
562
562
|
'<ng-form name="parent">' +
|
|
563
563
|
'<ng-form name="child">' +
|
|
564
|
-
'<input ng
|
|
565
|
-
'<input ng
|
|
564
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
565
|
+
'<input ng-model="modelB" name="inputB">' +
|
|
566
566
|
"</ng-form>" +
|
|
567
567
|
"</ng-form>",
|
|
568
568
|
);
|
|
@@ -581,7 +581,7 @@ describe("form", () => {
|
|
|
581
581
|
'<ng-form name="parent">' +
|
|
582
582
|
'<ng-form name="child">' +
|
|
583
583
|
'<ng-form name="grandchild">' +
|
|
584
|
-
'<input ng
|
|
584
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
585
585
|
"</ng-form>" +
|
|
586
586
|
"</ng-form>" +
|
|
587
587
|
"</ng-form>",
|
|
@@ -647,8 +647,8 @@ describe("form", () => {
|
|
|
647
647
|
'<ng-form name="parent">' +
|
|
648
648
|
'<ng-form name="child">' +
|
|
649
649
|
'<ng-form name="grandchild">' +
|
|
650
|
-
'<input ng
|
|
651
|
-
'<input ng
|
|
650
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
651
|
+
'<input ng-model="modelB" name="inputB">' +
|
|
652
652
|
"</ng-form>" +
|
|
653
653
|
"</ng-form>" +
|
|
654
654
|
"</ng-form>",
|
|
@@ -670,7 +670,7 @@ describe("form", () => {
|
|
|
670
670
|
doc = JQLite(
|
|
671
671
|
'<form name="parent">' +
|
|
672
672
|
'<div ng-form name="child">' +
|
|
673
|
-
'<input ng
|
|
673
|
+
'<input ng-model="modelA" name="inputA" required>' +
|
|
674
674
|
"</div>" +
|
|
675
675
|
"</form>",
|
|
676
676
|
);
|
|
@@ -694,7 +694,7 @@ describe("form", () => {
|
|
|
694
694
|
doc = JQLite(
|
|
695
695
|
'<form name="parent">' +
|
|
696
696
|
'<div ng-form name="child.form">' +
|
|
697
|
-
'<input ng
|
|
697
|
+
'<input ng-model="modelA" name="inputA" required>' +
|
|
698
698
|
"</div>" +
|
|
699
699
|
"</form>",
|
|
700
700
|
);
|
|
@@ -974,11 +974,11 @@ describe("form", () => {
|
|
|
974
974
|
|
|
975
975
|
it("should chain nested forms in repeater", () => {
|
|
976
976
|
doc = JQLite(
|
|
977
|
-
"<ng
|
|
978
|
-
'<ng
|
|
979
|
-
"<input type=text ng
|
|
980
|
-
"</ng
|
|
981
|
-
"</ng
|
|
977
|
+
"<ng-form name=parent>" +
|
|
978
|
+
'<ng-form ng-repeat="f in forms" name=child>' +
|
|
979
|
+
"<input type=text ng-model=text name=text>" +
|
|
980
|
+
"</ng-form>" +
|
|
981
|
+
"</ng-form>",
|
|
982
982
|
);
|
|
983
983
|
$compile(doc)(scope);
|
|
984
984
|
|
|
@@ -93,7 +93,7 @@ describe("ngInclude", () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it("should NOT use untrusted URL expressions ", () => {
|
|
96
|
-
element = JQLite('<ng
|
|
96
|
+
element = JQLite('<ng-include src="url"></ng-include>');
|
|
97
97
|
const injector = angular.bootstrap(element);
|
|
98
98
|
$rootScope = injector.get("$rootScope");
|
|
99
99
|
$rootScope.url = "http://example.com/myUrl";
|
|
@@ -103,7 +103,7 @@ describe("ngInclude", () => {
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
it("should NOT use mistyped expressions ", () => {
|
|
106
|
-
element = JQLite('<ng
|
|
106
|
+
element = JQLite('<ng-include src="url"></ng-include>');
|
|
107
107
|
const injector = angular.bootstrap(element);
|
|
108
108
|
$rootScope = injector.get("$rootScope");
|
|
109
109
|
$rootScope.name = "chirayu";
|
|
@@ -115,7 +115,7 @@ describe("ngInclude", () => {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
it("should remove previously included text if a falsy value is bound to src", (done) => {
|
|
118
|
-
element = JQLite('<div><ng
|
|
118
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
119
119
|
const injector = angular.bootstrap(element);
|
|
120
120
|
$rootScope = injector.get("$rootScope");
|
|
121
121
|
$rootScope.expr = "igor";
|
|
@@ -142,7 +142,7 @@ describe("ngInclude", () => {
|
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
element = JQLite(
|
|
145
|
-
'<div><div><ng
|
|
145
|
+
'<div><div><ng-include src="url"></ng-include></div></div>',
|
|
146
146
|
);
|
|
147
147
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
148
148
|
$rootScope = injector.get("$rootScope");
|
|
@@ -165,7 +165,7 @@ describe("ngInclude", () => {
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
element = JQLite(
|
|
168
|
-
'<div><div><ng
|
|
168
|
+
'<div><div><ng-include src="url"></ng-include></div></div>',
|
|
169
169
|
);
|
|
170
170
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
171
171
|
$rootScope = injector.get("$rootScope");
|
|
@@ -189,7 +189,7 @@ describe("ngInclude", () => {
|
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
element = JQLite(
|
|
192
|
-
'<div><div><ng
|
|
192
|
+
'<div><div><ng-include src="url"></ng-include></div></div>',
|
|
193
193
|
);
|
|
194
194
|
|
|
195
195
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
@@ -207,7 +207,7 @@ describe("ngInclude", () => {
|
|
|
207
207
|
window.angular.module("myModule", []);
|
|
208
208
|
|
|
209
209
|
element = JQLite(
|
|
210
|
-
'<div><div><ng
|
|
210
|
+
'<div><div><ng-include src="url" onload="loaded = true"></ng-include></div></div>',
|
|
211
211
|
);
|
|
212
212
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
213
213
|
$rootScope = injector.get("$rootScope");
|
|
@@ -227,7 +227,7 @@ describe("ngInclude", () => {
|
|
|
227
227
|
it("should create child scope and destroy old one", (done) => {
|
|
228
228
|
window.angular.module("myModule", []);
|
|
229
229
|
|
|
230
|
-
element = JQLite('<div><ng
|
|
230
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
231
231
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
232
232
|
$rootScope = injector.get("$rootScope");
|
|
233
233
|
$rootScope.$digest();
|
|
@@ -267,7 +267,7 @@ describe("ngInclude", () => {
|
|
|
267
267
|
|
|
268
268
|
it("should do xhr request and cache it", async () => {
|
|
269
269
|
window.angular.module("myModule", []);
|
|
270
|
-
element = JQLite('<div><ng
|
|
270
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
271
271
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
272
272
|
$rootScope = injector.get("$rootScope");
|
|
273
273
|
$rootScope.url = "/mock/hello";
|
|
@@ -287,7 +287,7 @@ describe("ngInclude", () => {
|
|
|
287
287
|
|
|
288
288
|
it("should clear content when error during xhr request", () => {
|
|
289
289
|
window.angular.module("myModule", []);
|
|
290
|
-
element = JQLite('<div><ng
|
|
290
|
+
element = JQLite('<div><ng-include src="url">content</ng-include></div>');
|
|
291
291
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
292
292
|
$rootScope = injector.get("$rootScope");
|
|
293
293
|
$rootScope.url = "/mock/401";
|
|
@@ -297,7 +297,7 @@ describe("ngInclude", () => {
|
|
|
297
297
|
|
|
298
298
|
it("should be async even if served from cache", (done) => {
|
|
299
299
|
window.angular.module("myModule", []);
|
|
300
|
-
element = JQLite('<div><ng
|
|
300
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
301
301
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
302
302
|
$rootScope = injector.get("$rootScope");
|
|
303
303
|
$rootScope.url = "/mock/hello";
|
|
@@ -319,7 +319,7 @@ describe("ngInclude", () => {
|
|
|
319
319
|
it("should discard pending xhr callbacks if a new template is requested before the current finished loading", (done) => {
|
|
320
320
|
window.angular.module("myModule", []);
|
|
321
321
|
element = JQLite(
|
|
322
|
-
"<div><ng
|
|
322
|
+
"<div><ng-include src='templateUrl'></ng-include></div>",
|
|
323
323
|
);
|
|
324
324
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
325
325
|
$rootScope = injector.get("$rootScope");
|
|
@@ -339,7 +339,7 @@ describe("ngInclude", () => {
|
|
|
339
339
|
it("should not break attribute bindings on the same element", async () => {
|
|
340
340
|
window.angular.module("myModule", []);
|
|
341
341
|
element = JQLite(
|
|
342
|
-
'<div><span foo="#/{{hrefUrl}}" ng
|
|
342
|
+
'<div><span foo="#/{{hrefUrl}}" ng-include="includeUrl"></span></div>',
|
|
343
343
|
);
|
|
344
344
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
345
345
|
$rootScope = injector.get("$rootScope");
|
|
@@ -457,7 +457,7 @@ describe("ngInclude", () => {
|
|
|
457
457
|
},
|
|
458
458
|
]);
|
|
459
459
|
element = JQLite(
|
|
460
|
-
'<div><ng
|
|
460
|
+
'<div><ng-include src="tpl" autoscroll></ng-include></div>',
|
|
461
461
|
);
|
|
462
462
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
463
463
|
$rootScope = injector.get("$rootScope");
|
|
@@ -480,7 +480,7 @@ describe("ngInclude", () => {
|
|
|
480
480
|
},
|
|
481
481
|
]);
|
|
482
482
|
element = JQLite(
|
|
483
|
-
'<div><ng
|
|
483
|
+
'<div><ng-include src="tpl" autoscroll="value"></ng-include></div>',
|
|
484
484
|
);
|
|
485
485
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
486
486
|
$rootScope = injector.get("$rootScope");
|
|
@@ -506,7 +506,7 @@ describe("ngInclude", () => {
|
|
|
506
506
|
},
|
|
507
507
|
]);
|
|
508
508
|
|
|
509
|
-
element = JQLite('<div><ng
|
|
509
|
+
element = JQLite('<div><ng-include src="tpl"></ng-include></div>');
|
|
510
510
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
511
511
|
$rootScope = injector.get("$rootScope");
|
|
512
512
|
|
|
@@ -530,7 +530,7 @@ describe("ngInclude", () => {
|
|
|
530
530
|
]);
|
|
531
531
|
|
|
532
532
|
element = JQLite(
|
|
533
|
-
'<div><ng
|
|
533
|
+
'<div><ng-include src="tpl" autoscroll="value"></ng-include></div>',
|
|
534
534
|
);
|
|
535
535
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
536
536
|
$rootScope = injector.get("$rootScope");
|
|
@@ -558,7 +558,7 @@ describe("ngInclude", () => {
|
|
|
558
558
|
|
|
559
559
|
// it('should only call $anchorScroll after the "enter" animation completes', inject(
|
|
560
560
|
// compileAndLink(
|
|
561
|
-
// '<div><ng
|
|
561
|
+
// '<div><ng-include src="tpl" autoscroll></ng-include></div>',
|
|
562
562
|
// ),
|
|
563
563
|
// ($rootScope, $animate, $timeout) => {
|
|
564
564
|
// expect(autoScrollSpy).not.toHaveBeenCalled();
|
|
@@ -103,10 +103,10 @@ describe("ngSwitch", () => {
|
|
|
103
103
|
|
|
104
104
|
it("should switch on switch-when-default", () => {
|
|
105
105
|
element = $compile(
|
|
106
|
-
'<ng
|
|
107
|
-
'<div ng
|
|
108
|
-
"<div ng
|
|
109
|
-
"</ng
|
|
106
|
+
'<ng-switch on="select">' +
|
|
107
|
+
'<div ng-switch-when="1">one</div>' +
|
|
108
|
+
"<div ng-switch-default>other</div>" +
|
|
109
|
+
"</ng-switch>",
|
|
110
110
|
)($scope);
|
|
111
111
|
$scope.$apply();
|
|
112
112
|
expect(element.text()).toEqual("other");
|
package/src/shared/constants.js
CHANGED
|
@@ -7,8 +7,9 @@ export const TOUCHED_CLASS = "ng-touched";
|
|
|
7
7
|
export const EMPTY_CLASS = "ng-empty";
|
|
8
8
|
export const NOT_EMPTY_CLASS = "ng-not-empty";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
export const
|
|
10
|
+
// x prefix is being kept for view-directive.spec lines 1550, 565
|
|
11
|
+
export const PREFIX_REGEXP = /^((?:x|data)[-])/i;
|
|
12
|
+
export const SPECIAL_CHARS_REGEXP = /[-]+(.)/g;
|
|
12
13
|
|
|
13
14
|
export const ALIASED_ATTR = {
|
|
14
15
|
ngMinlength: "minlength",
|
|
@@ -366,7 +366,7 @@ JQLite.prototype.removeData = function (name) {
|
|
|
366
366
|
/**
|
|
367
367
|
* Gets or sets data on a parent element
|
|
368
368
|
* @param {string} name
|
|
369
|
-
* @param {any} value
|
|
369
|
+
* @param {any} [value]
|
|
370
370
|
* @returns {JQLite|any}
|
|
371
371
|
*/
|
|
372
372
|
JQLite.prototype.inheritedData = function (name, value) {
|
|
@@ -383,7 +383,7 @@ JQLite.prototype.inheritedData = function (name, value) {
|
|
|
383
383
|
|
|
384
384
|
/**
|
|
385
385
|
* Gets or sets innerHTML on the first element in JQLite collection
|
|
386
|
-
* @param {string} value
|
|
386
|
+
* @param {string} [value]
|
|
387
387
|
* @returns {JQLite|any|undefined}
|
|
388
388
|
*/
|
|
389
389
|
JQLite.prototype.html = function (value) {
|
package/src/types.js
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @typedef {function
|
|
15
|
+
* @typedef {function} CompiledExpression
|
|
16
|
+
* @param {import('./core/scope/scope').Scope} context - An object against which any expressions embedded in the strings are evaluated against (typically a scope object).
|
|
17
|
+
* @param {object} [locals] - local variables context object, useful for overriding values in `context`.
|
|
18
|
+
* @returns {any}
|
|
16
19
|
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
17
20
|
* @property {boolean} constant - Indicates if the expression is constant.
|
|
18
21
|
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|