@angular-wave/angular.ts 0.0.47 → 0.0.49
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/angular.spec.js +1 -2
- package/src/animations/animate-queue.js +0 -1
- package/src/animations/animation.js +1 -1
- package/src/animations/raf-scheduler.js +0 -1
- package/src/animations/shared.js +1 -1
- package/src/core/animate/animate.js +0 -1
- package/src/core/compile/compile.md +1 -1
- package/src/core/compile/compile.spec.js +49 -47
- package/src/core/location/location.spec.js +1 -1
- package/src/core/on.spec.js +7 -12
- package/src/core/parser/ast-type.js +22 -0
- package/src/core/parser/ast.js +426 -0
- package/src/core/parser/compiler.js +561 -0
- package/src/core/parser/interpreter.js +422 -0
- package/src/core/parser/lexer.js +345 -0
- package/src/core/parser/parse.js +23 -1984
- package/src/core/parser/parse.md +57 -0
- package/src/core/parser/parse.spec.js +2 -2
- package/src/core/parser/parser.js +45 -0
- package/src/core/parser/shared.js +228 -0
- package/src/core/prop.spec.js +4 -4
- package/src/core/q/q.spec.js +0 -1
- package/src/core/sce/sce.js +3 -6
- package/src/core/scope/scope.js +33 -21
- package/src/core/task-tracker-factory.js +0 -1
- package/src/directive/class/class.js +0 -2
- package/src/directive/form/form.js +0 -3
- package/src/directive/form/form.spec.js +18 -18
- package/src/directive/include/include.js +1 -1
- package/src/directive/include/include.spec.js +18 -19
- package/src/directive/input/input.js +1 -2
- package/src/directive/model/model.js +1 -3
- package/src/directive/model/model.spec.js +0 -1
- package/src/directive/repeat/repeat.spec.js +0 -2
- package/src/directive/switch/switch.spec.js +4 -4
- package/src/exts/aria/aria.js +0 -1
- package/src/filters/filter.spec.js +0 -1
- package/src/injector.js +1 -1
- package/src/injector.spec.js +0 -5
- package/src/loader.js +0 -5
- package/src/services/cookie-reader.js +0 -1
- package/src/services/http/http.spec.js +0 -2
- package/src/shared/constants.js +3 -2
- package/src/shared/utils.js +18 -7
- package/src/types.js +10 -0
- package/types/core/parser/ast-type.d.ts +20 -0
- package/types/core/parser/ast.d.ts +86 -0
- package/types/core/parser/compiler.d.ts +49 -0
- package/types/core/parser/interpreter.d.ts +57 -0
- package/types/core/parser/lexer.d.ts +153 -0
- package/types/core/parser/parse.d.ts +68 -0
- package/types/core/parser/parser.d.ts +28 -0
- package/types/core/parser/shared.d.ts +29 -0
- package/types/core/scope/scope.d.ts +19 -12
- package/types/shared/utils.d.ts +18 -5
- package/types/types.d.ts +1 -0
- package/types-back/index.d.ts +0 -12
|
@@ -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");
|
|
@@ -381,7 +381,6 @@ describe("ngInclude", () => {
|
|
|
381
381
|
await wait(100);
|
|
382
382
|
const child = element.find("rect");
|
|
383
383
|
expect(child.length).toBe(2);
|
|
384
|
-
// // eslint-disable-next-line no-undef
|
|
385
384
|
expect(child[0] instanceof SVGRectElement).toBe(true);
|
|
386
385
|
});
|
|
387
386
|
|
|
@@ -458,7 +457,7 @@ describe("ngInclude", () => {
|
|
|
458
457
|
},
|
|
459
458
|
]);
|
|
460
459
|
element = JQLite(
|
|
461
|
-
'<div><ng
|
|
460
|
+
'<div><ng-include src="tpl" autoscroll></ng-include></div>',
|
|
462
461
|
);
|
|
463
462
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
464
463
|
$rootScope = injector.get("$rootScope");
|
|
@@ -481,7 +480,7 @@ describe("ngInclude", () => {
|
|
|
481
480
|
},
|
|
482
481
|
]);
|
|
483
482
|
element = JQLite(
|
|
484
|
-
'<div><ng
|
|
483
|
+
'<div><ng-include src="tpl" autoscroll="value"></ng-include></div>',
|
|
485
484
|
);
|
|
486
485
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
487
486
|
$rootScope = injector.get("$rootScope");
|
|
@@ -507,7 +506,7 @@ describe("ngInclude", () => {
|
|
|
507
506
|
},
|
|
508
507
|
]);
|
|
509
508
|
|
|
510
|
-
element = JQLite('<div><ng
|
|
509
|
+
element = JQLite('<div><ng-include src="tpl"></ng-include></div>');
|
|
511
510
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
512
511
|
$rootScope = injector.get("$rootScope");
|
|
513
512
|
|
|
@@ -531,7 +530,7 @@ describe("ngInclude", () => {
|
|
|
531
530
|
]);
|
|
532
531
|
|
|
533
532
|
element = JQLite(
|
|
534
|
-
'<div><ng
|
|
533
|
+
'<div><ng-include src="tpl" autoscroll="value"></ng-include></div>',
|
|
535
534
|
);
|
|
536
535
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
537
536
|
$rootScope = injector.get("$rootScope");
|
|
@@ -559,7 +558,7 @@ describe("ngInclude", () => {
|
|
|
559
558
|
|
|
560
559
|
// it('should only call $anchorScroll after the "enter" animation completes', inject(
|
|
561
560
|
// compileAndLink(
|
|
562
|
-
// '<div><ng
|
|
561
|
+
// '<div><ng-include src="tpl" autoscroll></ng-include></div>',
|
|
563
562
|
// ),
|
|
564
563
|
// ($rootScope, $animate, $timeout) => {
|
|
565
564
|
// expect(autoScrollSpy).not.toHaveBeenCalled();
|
|
@@ -34,7 +34,7 @@ export const ISO_DATE_REGEXP =
|
|
|
34
34
|
// 1111111111111111 222 333333 44444 55555555555555555555555 666 77777777 8888888 999
|
|
35
35
|
export const URL_REGEXP =
|
|
36
36
|
/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
export const EMAIL_REGEXP =
|
|
39
39
|
/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
|
|
40
40
|
const NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
|
|
@@ -1144,7 +1144,6 @@ export function isNumberInteger(num) {
|
|
|
1144
1144
|
// See http://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript#14794066
|
|
1145
1145
|
// (minus the assumption that `num` is a number)
|
|
1146
1146
|
|
|
1147
|
-
// eslint-disable-next-line no-bitwise
|
|
1148
1147
|
return (num | 0) === num;
|
|
1149
1148
|
}
|
|
1150
1149
|
|
|
@@ -328,7 +328,6 @@ NgModelController.prototype = {
|
|
|
328
328
|
* @returns {boolean} True if `value` is "empty".
|
|
329
329
|
*/
|
|
330
330
|
$isEmpty(value) {
|
|
331
|
-
// eslint-disable-next-line no-self-compare
|
|
332
331
|
return (
|
|
333
332
|
isUndefined(value) || value === "" || value === null || value !== value
|
|
334
333
|
);
|
|
@@ -771,7 +770,6 @@ NgModelController.prototype = {
|
|
|
771
770
|
try {
|
|
772
771
|
listener();
|
|
773
772
|
} catch (e) {
|
|
774
|
-
// eslint-disable-next-line no-invalid-this
|
|
775
773
|
this.$$exceptionHandler(e);
|
|
776
774
|
}
|
|
777
775
|
},
|
|
@@ -1082,7 +1080,7 @@ function setupModelWatcher(ctrl) {
|
|
|
1082
1080
|
if (
|
|
1083
1081
|
modelValue !== ctrl.$modelValue &&
|
|
1084
1082
|
// checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
|
|
1085
|
-
|
|
1083
|
+
|
|
1086
1084
|
(ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
|
|
1087
1085
|
) {
|
|
1088
1086
|
ctrl.$$setModelValue(modelValue);
|
|
@@ -1173,7 +1173,6 @@ describe("ngModel", () => {
|
|
|
1173
1173
|
});
|
|
1174
1174
|
|
|
1175
1175
|
it("should be possible to extend Object prototype and still be able to do form validation", () => {
|
|
1176
|
-
// eslint-disable-next-line no-extend-native
|
|
1177
1176
|
Object.prototype.someThing = function () {};
|
|
1178
1177
|
const element = $compile(
|
|
1179
1178
|
'<form name="myForm">' +
|
|
@@ -129,7 +129,6 @@ describe("ngRepeat", () => {
|
|
|
129
129
|
|
|
130
130
|
it("should iterate over an array-like class", () => {
|
|
131
131
|
function Collection() {}
|
|
132
|
-
// eslint-disable-next-line no-array-constructor
|
|
133
132
|
Collection.prototype = new Array();
|
|
134
133
|
Collection.prototype.length = 0;
|
|
135
134
|
|
|
@@ -296,7 +295,6 @@ describe("ngRepeat", () => {
|
|
|
296
295
|
"</ul>",
|
|
297
296
|
)(scope);
|
|
298
297
|
|
|
299
|
-
// eslint-disable-next-line no-extend-native
|
|
300
298
|
Array.prototype.extraProperty = "should be ignored";
|
|
301
299
|
// INIT
|
|
302
300
|
scope.items = [true, true, true];
|
|
@@ -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/exts/aria/aria.js
CHANGED
package/src/injector.js
CHANGED
|
@@ -275,7 +275,7 @@ export function createInjector(modulesToLoad, strictDi) {
|
|
|
275
275
|
// unlike those of Chrome and IE
|
|
276
276
|
// So if stack doesn't contain message, we create a new string that contains both.
|
|
277
277
|
// Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
|
|
278
|
-
|
|
278
|
+
|
|
279
279
|
e = `${e.message}\n${e.stack}`;
|
|
280
280
|
}
|
|
281
281
|
throw $injectorMinErr(
|
package/src/injector.spec.js
CHANGED
|
@@ -461,21 +461,17 @@ describe("annotate", () => {
|
|
|
461
461
|
|
|
462
462
|
describe("es6", () => {
|
|
463
463
|
it("should be possible to annotate shorthand methods", () => {
|
|
464
|
-
// eslint-disable-next-line no-eval
|
|
465
464
|
expect(annotate(eval("({ fn(x) { return; } })").fn)).toEqual(["x"]);
|
|
466
465
|
});
|
|
467
466
|
|
|
468
467
|
it("should create $inject for arrow functions", () => {
|
|
469
|
-
// eslint-disable-next-line no-eval
|
|
470
468
|
expect(annotate(eval("(a, b) => a"))).toEqual(["a", "b"]);
|
|
471
469
|
});
|
|
472
470
|
it("should create $inject for arrow functions with no parenthesis", () => {
|
|
473
|
-
// eslint-disable-next-line no-eval
|
|
474
471
|
expect(annotate(eval("a => a"))).toEqual(["a"]);
|
|
475
472
|
});
|
|
476
473
|
|
|
477
474
|
it("should take args before first arrow", () => {
|
|
478
|
-
// eslint-disable-next-line no-eval
|
|
479
475
|
expect(annotate(eval("a => b => b"))).toEqual(["a"]);
|
|
480
476
|
});
|
|
481
477
|
|
|
@@ -492,7 +488,6 @@ describe("annotate", () => {
|
|
|
492
488
|
"class/* Test */{}",
|
|
493
489
|
"class /* Test */ {}",
|
|
494
490
|
].forEach((classDefinition) => {
|
|
495
|
-
// eslint-disable-next-line no-eval
|
|
496
491
|
const Clazz = eval(`(${classDefinition})`);
|
|
497
492
|
const instance = injector.invoke(Clazz);
|
|
498
493
|
|
package/src/loader.js
CHANGED
|
@@ -174,7 +174,6 @@ export class Angular {
|
|
|
174
174
|
* @returns {angular.auto.IInjectorService} Returns the newly created injector for this app.
|
|
175
175
|
*/
|
|
176
176
|
bootstrap(element, modules, config) {
|
|
177
|
-
// eslint-disable-next-line no-param-reassign
|
|
178
177
|
config = config || {
|
|
179
178
|
debugInfoEnabled: false,
|
|
180
179
|
strictDi: false,
|
|
@@ -333,7 +332,6 @@ export class Angular {
|
|
|
333
332
|
}
|
|
334
333
|
|
|
335
334
|
function ensure(obj, name, factory) {
|
|
336
|
-
// eslint-disable-next-line no-return-assign, no-param-reassign
|
|
337
335
|
return obj[name] || (obj[name] = factory());
|
|
338
336
|
}
|
|
339
337
|
|
|
@@ -357,7 +355,6 @@ export class Angular {
|
|
|
357
355
|
/** @type {!Array.<Function>} */
|
|
358
356
|
const runBlocks = [];
|
|
359
357
|
|
|
360
|
-
// eslint-disable-next-line no-use-before-define
|
|
361
358
|
const config = invokeLater("$injector", "invoke", "push", configBlocks);
|
|
362
359
|
|
|
363
360
|
/** @type {import('./types').Module} */
|
|
@@ -883,7 +880,6 @@ export function setupModuleLoader(window) {
|
|
|
883
880
|
const $injectorMinErr = minErr("$injector");
|
|
884
881
|
|
|
885
882
|
function ensure(obj, name, factory) {
|
|
886
|
-
// eslint-disable-next-line no-return-assign
|
|
887
883
|
return obj[name] || (obj[name] = factory());
|
|
888
884
|
}
|
|
889
885
|
|
|
@@ -974,7 +970,6 @@ export function setupModuleLoader(window) {
|
|
|
974
970
|
/** @type {!Array.<Function>} */
|
|
975
971
|
const runBlocks = [];
|
|
976
972
|
|
|
977
|
-
// eslint-disable-next-line no-use-before-define
|
|
978
973
|
const config = invokeLater("$injector", "invoke", "push", configBlocks);
|
|
979
974
|
|
|
980
975
|
/** @type {import('./types').Module} */
|
|
@@ -43,7 +43,6 @@ export function $$CookieReader($document) {
|
|
|
43
43
|
cookieArray = lastCookieString.split("; ");
|
|
44
44
|
lastCookies = {};
|
|
45
45
|
|
|
46
|
-
// eslint-disable-next-line no-plusplus
|
|
47
46
|
for (i = 0; i < cookieArray.length; i++) {
|
|
48
47
|
cookie = cookieArray[i];
|
|
49
48
|
index = cookie.indexOf("=");
|
|
@@ -2417,7 +2417,6 @@ describe("$http", function () {
|
|
|
2417
2417
|
// it("should ignore Blob objects", () => {
|
|
2418
2418
|
// if (!window.Blob) return;
|
|
2419
2419
|
|
|
2420
|
-
// // eslint-disable-next-line no-undef
|
|
2421
2420
|
// const blob = new Blob(["blob!"], { type: "text/plain" });
|
|
2422
2421
|
|
|
2423
2422
|
// $httpBackend.expect("POST", "/url", "[object Blob]").respond("");
|
|
@@ -2427,7 +2426,6 @@ describe("$http", function () {
|
|
|
2427
2426
|
// it("should ignore FormData objects", () => {
|
|
2428
2427
|
// if (!window.FormData) return;
|
|
2429
2428
|
|
|
2430
|
-
// // eslint-disable-next-line no-undef
|
|
2431
2429
|
// const formData = new FormData();
|
|
2432
2430
|
// formData.append("angular", "is great");
|
|
2433
2431
|
|
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",
|
package/src/shared/utils.js
CHANGED
|
@@ -309,7 +309,6 @@ export function trim(value) {
|
|
|
309
309
|
return isString(value) ? value.trim() : value;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
// eslint-disable-next-line camelcase
|
|
313
312
|
export function snakeCase(name, separator) {
|
|
314
313
|
const modseparator = separator || "_";
|
|
315
314
|
return name.replace(
|
|
@@ -399,7 +398,7 @@ export function forEachSorted(obj, iterator, context) {
|
|
|
399
398
|
|
|
400
399
|
/**
|
|
401
400
|
* when using forEach the params are value, key, but it is often useful to have key, value.
|
|
402
|
-
* @param {function(string, *)} iteratorFn
|
|
401
|
+
* @param {function(string, *):any} iteratorFn
|
|
403
402
|
* @returns {function(*, string)}
|
|
404
403
|
*/
|
|
405
404
|
export function reverseParams(iteratorFn) {
|
|
@@ -473,8 +472,8 @@ export function baseExtend(dst, objs, deep) {
|
|
|
473
472
|
* @param {...Object} src Source object(s).
|
|
474
473
|
* @returns {Object} Reference to `dst`.
|
|
475
474
|
*/
|
|
476
|
-
export function extend(dst) {
|
|
477
|
-
return baseExtend(dst,
|
|
475
|
+
export function extend(dst, ...src) {
|
|
476
|
+
return baseExtend(dst, src, false);
|
|
478
477
|
}
|
|
479
478
|
|
|
480
479
|
/**
|
|
@@ -515,15 +514,27 @@ export function merge(dst, ...src) {
|
|
|
515
514
|
return baseExtend(dst, src, true);
|
|
516
515
|
}
|
|
517
516
|
|
|
517
|
+
/**
|
|
518
|
+
* @param {string} str
|
|
519
|
+
* @returns {number}
|
|
520
|
+
*/
|
|
518
521
|
export function toInt(str) {
|
|
519
522
|
return parseInt(str, 10);
|
|
520
523
|
}
|
|
521
524
|
|
|
525
|
+
/**
|
|
526
|
+
* @param {any} num
|
|
527
|
+
* @returns {boolean}
|
|
528
|
+
*/
|
|
522
529
|
export function isNumberNaN(num) {
|
|
523
|
-
// eslint-disable-next-line no-self-compare
|
|
524
530
|
return Number.isNaN(num);
|
|
525
531
|
}
|
|
526
532
|
|
|
533
|
+
/**
|
|
534
|
+
* @param {Object} parent
|
|
535
|
+
* @param {Object} extra
|
|
536
|
+
* @returns {Object}
|
|
537
|
+
*/
|
|
527
538
|
export function inherit(parent, extra) {
|
|
528
539
|
return extend(Object.create(parent), extra);
|
|
529
540
|
}
|
|
@@ -599,7 +610,7 @@ export function isElement(node) {
|
|
|
599
610
|
*
|
|
600
611
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
|
|
601
612
|
*
|
|
602
|
-
* @param {JQLite|Element} element
|
|
613
|
+
* @param {import('../shared/jqlite/jqlite').JQLite|Element} element
|
|
603
614
|
* @returns
|
|
604
615
|
*/
|
|
605
616
|
export function getNodeName(element) {
|
|
@@ -699,7 +710,7 @@ export function simpleCompare(a, b) {
|
|
|
699
710
|
export function equals(o1, o2) {
|
|
700
711
|
if (o1 === o2) return true;
|
|
701
712
|
if (o1 === null || o2 === null) return false;
|
|
702
|
-
|
|
713
|
+
|
|
703
714
|
if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
|
|
704
715
|
const t1 = typeof o1;
|
|
705
716
|
const t2 = typeof o2;
|
package/src/types.js
CHANGED
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
* @template T
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object|function(any, any=): any} CompiledExpression
|
|
16
|
+
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
17
|
+
* @property {boolean} constant - Indicates if the expression is constant.
|
|
18
|
+
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|
|
19
|
+
* undefined is gonna be used since the implementation
|
|
20
|
+
* does not check the parameter. Let's force a value for consistency. If consumer
|
|
21
|
+
* wants to undefine it, pass the undefined value explicitly.
|
|
22
|
+
*/
|
|
23
|
+
|
|
14
24
|
/**
|
|
15
25
|
* @typedef {Object} ComponentOptions
|
|
16
26
|
* @description Component definition object (a simplified directive definition object)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ASTType = ("Program" | "ExpressionStatement" | "AssignmentExpression" | "ConditionalExpression" | "LogicalExpression" | "BinaryExpression" | "UnaryExpression" | "CallExpression" | "MemberExpression" | "Identifier" | "Literal" | "ArrayExpression" | "Property" | "ObjectExpression" | "ThisExpression" | "LocalsExpression" | "NGValueParameter");
|
|
2
|
+
export namespace ASTType {
|
|
3
|
+
let Program: string;
|
|
4
|
+
let ExpressionStatement: string;
|
|
5
|
+
let AssignmentExpression: string;
|
|
6
|
+
let ConditionalExpression: string;
|
|
7
|
+
let LogicalExpression: string;
|
|
8
|
+
let BinaryExpression: string;
|
|
9
|
+
let UnaryExpression: string;
|
|
10
|
+
let CallExpression: string;
|
|
11
|
+
let MemberExpression: string;
|
|
12
|
+
let Identifier: string;
|
|
13
|
+
let Literal: string;
|
|
14
|
+
let ArrayExpression: string;
|
|
15
|
+
let Property: string;
|
|
16
|
+
let ObjectExpression: string;
|
|
17
|
+
let ThisExpression: string;
|
|
18
|
+
let LocalsExpression: string;
|
|
19
|
+
let NGValueParameter: string;
|
|
20
|
+
}
|