@angular-wave/angular.ts 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +12 -2
- package/index.html +74 -3
- package/package.json +7 -7
- package/src/angular.spec.js +1 -269
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +12 -21
- package/src/animations/animate-js-driver.js +1 -3
- package/src/animations/animate-js.js +4 -4
- package/src/animations/animate-queue.js +23 -23
- 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 +4 -4
- package/src/animations/shared.js +14 -12
- package/src/binding.spec.js +0 -1
- package/src/core/cache/cache.js +2 -29
- package/src/core/compile/attributes.js +2 -3
- package/src/core/compile/compile.js +260 -245
- package/src/core/compile/compile.spec.js +63 -317
- 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/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 +28 -7
- package/src/core/parse/parse.spec.js +95 -91
- package/src/core/prop.spec.js +4 -60
- package/src/core/sce/sce.js +1 -2
- package/src/core/sce/sce.spec.js +0 -8
- package/src/core/scope/scope.js +62 -32
- 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/{list/list.test.js → attrs/attrs.test.js} +1 -1
- package/src/{core/q/q.html → directive/attrs/boolean.html} +1 -1
- package/src/directive/attrs/boolean.spec.js +0 -15
- package/src/{core/q/q.test.js → directive/attrs/boolean.test.js} +1 -2
- package/src/{core/timeout/timeout.html → directive/attrs/element-style.html} +4 -1
- package/src/directive/attrs/element-style.spec.js +0 -8
- package/src/{core/scope/scope.test.js → directive/attrs/element-style.test.js} +1 -2
- 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 +1 -4
- package/src/{core/interval/interval.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/channel/channel.test.js +9 -0
- 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 +14 -22
- package/src/directive/form/form.spec.js +0 -65
- package/src/directive/if/if.spec.js +2 -7
- package/src/directive/if/if.test.js +1 -2
- package/src/directive/include/include.js +2 -2
- 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.js +1 -2
- package/src/directive/input/input.spec.js +191 -331
- package/src/directive/messages/messages.spec.js +4 -35
- package/src/directive/model/model.js +30 -42
- package/src/directive/model/model.spec.js +2 -49
- package/src/directive/model-options/model-options.js +22 -26
- 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.js +1 -3
- package/src/directive/options/options.spec.js +3 -38
- package/src/directive/ref/href.spec.js +0 -15
- package/src/directive/repeat/repeat.js +2 -2
- package/src/directive/repeat/repeat.spec.js +56 -192
- package/src/directive/script/script.spec.js +0 -2
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +9 -106
- 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.js +1 -2
- 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 +24 -30
- package/src/router/directives/state-directives.spec.js +0 -83
- package/src/router/directives/view-directive.js +6 -15
- 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 +9 -12
- 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/url/url-service.js +2 -8
- package/src/router/url/url-service.spec.js +3 -4
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +4 -6
- package/src/services/http/http.js +11 -15
- 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.js +19 -17
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +2 -4
- package/src/shared/common.js +6 -10
- package/src/shared/jqlite/jqlite.js +14 -15
- package/src/shared/jqlite/jqlite.spec.js +2 -2
- package/src/shared/utils.js +15 -92
- 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/types/directive/form/form.d.ts +1 -0
- package/types/shared/common.d.ts +0 -1
- package/types/shared/utils.d.ts +0 -35
- package/src/core/interval/interval-factory.js +0 -50
- 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/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",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"generate-docs": "node_modules/.bin/typedoc"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@playwright/test": "
|
|
29
|
+
"@playwright/test": "latest",
|
|
30
30
|
"@rollup/plugin-commonjs": "latest",
|
|
31
31
|
"@rollup/plugin-node-resolve": "latest",
|
|
32
|
-
"@rollup/plugin-terser": "
|
|
32
|
+
"@rollup/plugin-terser": "latest",
|
|
33
33
|
"@types/jasmine": "latest",
|
|
34
34
|
"@types/node": "latest",
|
|
35
|
-
"docdash": "
|
|
35
|
+
"docdash": "latest",
|
|
36
36
|
"eslint": "latest",
|
|
37
37
|
"eslint-config-airbnb-base": "latest",
|
|
38
38
|
"eslint-config-prettier": "latest",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"eslint-plugin-promise": "latest",
|
|
41
41
|
"express": "latest",
|
|
42
42
|
"jasmine-core": "latest",
|
|
43
|
-
"jsdoc": "
|
|
43
|
+
"jsdoc": "latest",
|
|
44
44
|
"npm-run-all": "latest",
|
|
45
|
-
"playwright": "
|
|
45
|
+
"playwright": "latest",
|
|
46
46
|
"prettier": "latest",
|
|
47
47
|
"rollup": "latest",
|
|
48
|
-
"rollup-plugin-version-injector": "
|
|
48
|
+
"rollup-plugin-version-injector": "latest",
|
|
49
49
|
"sinon": "latest",
|
|
50
50
|
"typedoc": "latest",
|
|
51
51
|
"typescript": "latest",
|
package/src/angular.spec.js
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
isArrayLike,
|
|
18
18
|
encodeUriSegment,
|
|
19
19
|
encodeUriQuery,
|
|
20
|
-
forEach,
|
|
21
20
|
toJson,
|
|
22
21
|
fromJson,
|
|
23
22
|
nextUid,
|
|
@@ -1257,268 +1256,6 @@ describe("angular", () => {
|
|
|
1257
1256
|
});
|
|
1258
1257
|
});
|
|
1259
1258
|
|
|
1260
|
-
describe("forEach", () => {
|
|
1261
|
-
it("should iterate over *own* object properties", () => {
|
|
1262
|
-
function MyObj() {
|
|
1263
|
-
this.bar = "barVal";
|
|
1264
|
-
this.baz = "bazVal";
|
|
1265
|
-
}
|
|
1266
|
-
MyObj.prototype.foo = "fooVal";
|
|
1267
|
-
|
|
1268
|
-
const obj = new MyObj();
|
|
1269
|
-
const log = [];
|
|
1270
|
-
|
|
1271
|
-
forEach(obj, (value, key) => {
|
|
1272
|
-
log.push(`${key}:${value}`);
|
|
1273
|
-
});
|
|
1274
|
-
|
|
1275
|
-
expect(log).toEqual(["bar:barVal", "baz:bazVal"]);
|
|
1276
|
-
});
|
|
1277
|
-
|
|
1278
|
-
it("should not break if obj is an array we override hasOwnProperty", () => {
|
|
1279
|
-
const obj = [];
|
|
1280
|
-
obj[0] = 1;
|
|
1281
|
-
obj[1] = 2;
|
|
1282
|
-
obj.hasOwnProperty = null;
|
|
1283
|
-
const log = [];
|
|
1284
|
-
forEach(obj, (value, key) => {
|
|
1285
|
-
log.push(`${key}:${value}`);
|
|
1286
|
-
});
|
|
1287
|
-
expect(log).toEqual(["0:1", "1:2"]);
|
|
1288
|
-
});
|
|
1289
|
-
|
|
1290
|
-
it("should handle JQLite and jQuery objects like arrays", () => {
|
|
1291
|
-
let jqObject = JQLite("<p><span>s1</span><span>s2</span></p>").find(
|
|
1292
|
-
"span",
|
|
1293
|
-
);
|
|
1294
|
-
let log = [];
|
|
1295
|
-
|
|
1296
|
-
forEach(jqObject, (value, key) => {
|
|
1297
|
-
log.push(`${key}:${value.innerHTML}`);
|
|
1298
|
-
});
|
|
1299
|
-
expect(log).toEqual(["0:s1", "1:s2"]);
|
|
1300
|
-
|
|
1301
|
-
log = [];
|
|
1302
|
-
jqObject = JQLite("<pane></pane>");
|
|
1303
|
-
forEach(jqObject.children(), (value, key) => {
|
|
1304
|
-
log.push(`${key}:${value.innerHTML}`);
|
|
1305
|
-
});
|
|
1306
|
-
expect(log).toEqual([]);
|
|
1307
|
-
});
|
|
1308
|
-
|
|
1309
|
-
it("should handle NodeList objects like arrays", () => {
|
|
1310
|
-
const nodeList = JQLite(
|
|
1311
|
-
"<p><span>a</span><span>b</span><span>c</span></p>",
|
|
1312
|
-
)[0].childNodes;
|
|
1313
|
-
const log = [];
|
|
1314
|
-
|
|
1315
|
-
forEach(nodeList, (value, key) => {
|
|
1316
|
-
log.push(`${key}:${value.innerHTML}`);
|
|
1317
|
-
});
|
|
1318
|
-
expect(log).toEqual(["0:a", "1:b", "2:c"]);
|
|
1319
|
-
});
|
|
1320
|
-
|
|
1321
|
-
it("should handle HTMLCollection objects like arrays", () => {
|
|
1322
|
-
document.getElementById("dummy").innerHTML =
|
|
1323
|
-
"<p>" +
|
|
1324
|
-
"<a name='x'>a</a>" +
|
|
1325
|
-
"<a name='y'>b</a>" +
|
|
1326
|
-
"<a name='x'>c</a>" +
|
|
1327
|
-
"</p>";
|
|
1328
|
-
|
|
1329
|
-
const htmlCollection = document.getElementsByName("x");
|
|
1330
|
-
const log = [];
|
|
1331
|
-
|
|
1332
|
-
forEach(htmlCollection, (value, key) => {
|
|
1333
|
-
log.push(`${key}:${value.innerHTML}`);
|
|
1334
|
-
});
|
|
1335
|
-
expect(log).toEqual(["0:a", "1:c"]);
|
|
1336
|
-
});
|
|
1337
|
-
|
|
1338
|
-
it("should handle arguments objects like arrays", () => {
|
|
1339
|
-
let args;
|
|
1340
|
-
const log = [];
|
|
1341
|
-
|
|
1342
|
-
(function () {
|
|
1343
|
-
args = arguments;
|
|
1344
|
-
})("a", "b", "c");
|
|
1345
|
-
|
|
1346
|
-
forEach(args, (value, key) => {
|
|
1347
|
-
log.push(`${key}:${value}`);
|
|
1348
|
-
});
|
|
1349
|
-
expect(log).toEqual(["0:a", "1:b", "2:c"]);
|
|
1350
|
-
});
|
|
1351
|
-
|
|
1352
|
-
it("should handle string values like arrays", () => {
|
|
1353
|
-
const log = [];
|
|
1354
|
-
|
|
1355
|
-
forEach("bar", (value, key) => {
|
|
1356
|
-
log.push(`${key}:${value}`);
|
|
1357
|
-
});
|
|
1358
|
-
expect(log).toEqual(["0:b", "1:a", "2:r"]);
|
|
1359
|
-
});
|
|
1360
|
-
|
|
1361
|
-
it("should handle objects with length property as objects", () => {
|
|
1362
|
-
const obj = {
|
|
1363
|
-
foo: "bar",
|
|
1364
|
-
length: 2,
|
|
1365
|
-
};
|
|
1366
|
-
const log = [];
|
|
1367
|
-
|
|
1368
|
-
forEach(obj, (value, key) => {
|
|
1369
|
-
log.push(`${key}:${value}`);
|
|
1370
|
-
});
|
|
1371
|
-
expect(log).toEqual(["foo:bar", "length:2"]);
|
|
1372
|
-
});
|
|
1373
|
-
|
|
1374
|
-
it("should handle objects of custom types with length property as objects", () => {
|
|
1375
|
-
function CustomType() {
|
|
1376
|
-
this.length = 2;
|
|
1377
|
-
this.foo = "bar";
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
const obj = new CustomType();
|
|
1381
|
-
const log = [];
|
|
1382
|
-
|
|
1383
|
-
forEach(obj, (value, key) => {
|
|
1384
|
-
log.push(`${key}:${value}`);
|
|
1385
|
-
});
|
|
1386
|
-
expect(log).toEqual(["length:2", "foo:bar"]);
|
|
1387
|
-
});
|
|
1388
|
-
|
|
1389
|
-
it("should not invoke the iterator for indexed properties which are not present in the collection", () => {
|
|
1390
|
-
const log = [];
|
|
1391
|
-
const collection = [];
|
|
1392
|
-
collection[5] = "SPARSE";
|
|
1393
|
-
forEach(collection, (item, index) => {
|
|
1394
|
-
log.push(item + index);
|
|
1395
|
-
});
|
|
1396
|
-
expect(log.length).toBe(1);
|
|
1397
|
-
expect(log[0]).toBe("SPARSE5");
|
|
1398
|
-
});
|
|
1399
|
-
|
|
1400
|
-
it("should safely iterate through objects with no prototype parent", () => {
|
|
1401
|
-
const obj = extend(Object.create(null), {
|
|
1402
|
-
a: 1,
|
|
1403
|
-
b: 2,
|
|
1404
|
-
c: 3,
|
|
1405
|
-
});
|
|
1406
|
-
const log = [];
|
|
1407
|
-
const self = {};
|
|
1408
|
-
forEach(
|
|
1409
|
-
obj,
|
|
1410
|
-
function (val, key, collection) {
|
|
1411
|
-
expect(this).toBe(self);
|
|
1412
|
-
expect(collection).toBe(obj);
|
|
1413
|
-
log.push(`${key}=${val}`);
|
|
1414
|
-
},
|
|
1415
|
-
self,
|
|
1416
|
-
);
|
|
1417
|
-
expect(log.length).toBe(3);
|
|
1418
|
-
expect(log).toEqual(["a=1", "b=2", "c=3"]);
|
|
1419
|
-
});
|
|
1420
|
-
|
|
1421
|
-
it("should safely iterate through objects which shadow Object.prototype.hasOwnProperty", () => {
|
|
1422
|
-
const obj = {
|
|
1423
|
-
hasOwnProperty: true,
|
|
1424
|
-
a: 1,
|
|
1425
|
-
b: 2,
|
|
1426
|
-
c: 3,
|
|
1427
|
-
};
|
|
1428
|
-
const log = [];
|
|
1429
|
-
const self = {};
|
|
1430
|
-
forEach(
|
|
1431
|
-
obj,
|
|
1432
|
-
function (val, key, collection) {
|
|
1433
|
-
expect(this).toBe(self);
|
|
1434
|
-
expect(collection).toBe(obj);
|
|
1435
|
-
log.push(`${key}=${val}`);
|
|
1436
|
-
},
|
|
1437
|
-
self,
|
|
1438
|
-
);
|
|
1439
|
-
expect(log.length).toBe(4);
|
|
1440
|
-
expect(log).toEqual(["hasOwnProperty=true", "a=1", "b=2", "c=3"]);
|
|
1441
|
-
});
|
|
1442
|
-
|
|
1443
|
-
describe("ES spec api compliance", () => {
|
|
1444
|
-
function testForEachSpec(expectedSize, collection) {
|
|
1445
|
-
const that = {};
|
|
1446
|
-
|
|
1447
|
-
forEach(
|
|
1448
|
-
collection,
|
|
1449
|
-
function (value, key, collectionArg) {
|
|
1450
|
-
expect(collectionArg).toBe(collection);
|
|
1451
|
-
expect(collectionArg[key]).toBe(value);
|
|
1452
|
-
|
|
1453
|
-
expect(this).toBe(that);
|
|
1454
|
-
|
|
1455
|
-
expectedSize--;
|
|
1456
|
-
},
|
|
1457
|
-
that,
|
|
1458
|
-
);
|
|
1459
|
-
|
|
1460
|
-
expect(expectedSize).toBe(0);
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
it("should follow the ES spec when called with array", () => {
|
|
1464
|
-
testForEachSpec(2, [1, 2]);
|
|
1465
|
-
});
|
|
1466
|
-
|
|
1467
|
-
it("should follow the ES spec when called with arguments", () => {
|
|
1468
|
-
testForEachSpec(
|
|
1469
|
-
2,
|
|
1470
|
-
(function () {
|
|
1471
|
-
return arguments;
|
|
1472
|
-
})(1, 2),
|
|
1473
|
-
);
|
|
1474
|
-
});
|
|
1475
|
-
|
|
1476
|
-
it("should follow the ES spec when called with string", () => {
|
|
1477
|
-
testForEachSpec(2, "12");
|
|
1478
|
-
});
|
|
1479
|
-
|
|
1480
|
-
it("should follow the ES spec when called with jQuery/shared/jqlite/jqlite", () => {
|
|
1481
|
-
testForEachSpec(2, JQLite("<span>a</span><span>b</span>"));
|
|
1482
|
-
});
|
|
1483
|
-
|
|
1484
|
-
it("should follow the ES spec when called with childNodes NodeList", () => {
|
|
1485
|
-
testForEachSpec(
|
|
1486
|
-
2,
|
|
1487
|
-
JQLite("<p><span>a</span><span>b</span></p>")[0].childNodes,
|
|
1488
|
-
);
|
|
1489
|
-
});
|
|
1490
|
-
|
|
1491
|
-
it("should follow the ES spec when called with getElementsByTagName HTMLCollection", () => {
|
|
1492
|
-
testForEachSpec(
|
|
1493
|
-
2,
|
|
1494
|
-
JQLite("<p><span>a</span><span>b</span></p>")[0].getElementsByTagName(
|
|
1495
|
-
"*",
|
|
1496
|
-
),
|
|
1497
|
-
);
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
it("should follow the ES spec when called with querySelectorAll HTMLCollection", () => {
|
|
1501
|
-
testForEachSpec(
|
|
1502
|
-
2,
|
|
1503
|
-
JQLite("<p><span>a</span><span>b</span></p>")[0].querySelectorAll(
|
|
1504
|
-
"*",
|
|
1505
|
-
),
|
|
1506
|
-
);
|
|
1507
|
-
});
|
|
1508
|
-
|
|
1509
|
-
it("should follow the ES spec when called with JSON", () => {
|
|
1510
|
-
testForEachSpec(2, { a: 1, b: 2 });
|
|
1511
|
-
});
|
|
1512
|
-
|
|
1513
|
-
it("should follow the ES spec when called with function", () => {
|
|
1514
|
-
function f() {}
|
|
1515
|
-
f.a = 1;
|
|
1516
|
-
f.b = 2;
|
|
1517
|
-
testForEachSpec(2, f);
|
|
1518
|
-
});
|
|
1519
|
-
});
|
|
1520
|
-
});
|
|
1521
|
-
|
|
1522
1259
|
describe("encodeUriSegment", () => {
|
|
1523
1260
|
it("should correctly encode uri segment and not encode chars defined as pchar set in rfc3986", () => {
|
|
1524
1261
|
// don't encode alphanum
|
|
@@ -1782,7 +1519,6 @@ describe("angular", () => {
|
|
|
1782
1519
|
'<div>{{greeting = "hello world"}}</div>',
|
|
1783
1520
|
);
|
|
1784
1521
|
element = $compile(template)($rootScope);
|
|
1785
|
-
$rootScope.$digest();
|
|
1786
1522
|
expect(template.text()).toEqual("hello world");
|
|
1787
1523
|
expect($rootScope.greeting).toEqual("hello world");
|
|
1788
1524
|
});
|
|
@@ -1792,7 +1528,6 @@ describe("angular", () => {
|
|
|
1792
1528
|
'<div>{{greeting = "hello world"}}</div>',
|
|
1793
1529
|
);
|
|
1794
1530
|
element = $compile(template)($rootScope);
|
|
1795
|
-
$rootScope.$digest();
|
|
1796
1531
|
expect(template.text()).toEqual("hello world");
|
|
1797
1532
|
});
|
|
1798
1533
|
|
|
@@ -1805,8 +1540,6 @@ describe("angular", () => {
|
|
|
1805
1540
|
element = compile($rootScope, (clone) => {
|
|
1806
1541
|
templateClone = clone;
|
|
1807
1542
|
});
|
|
1808
|
-
$rootScope.$digest();
|
|
1809
|
-
|
|
1810
1543
|
expect(template.text()).toEqual('{{greeting = "hello world"}}');
|
|
1811
1544
|
expect(element.text()).toEqual("hello world");
|
|
1812
1545
|
expect(element).toEqual(templateClone);
|
|
@@ -1816,7 +1549,6 @@ describe("angular", () => {
|
|
|
1816
1549
|
it("should link to cloned node and create scope", () => {
|
|
1817
1550
|
const template = JQLite('<div>{{greeting = "hello world"}}</div>');
|
|
1818
1551
|
element = $compile(template)($rootScope, () => {});
|
|
1819
|
-
$rootScope.$digest();
|
|
1820
1552
|
expect(template.text()).toEqual('{{greeting = "hello world"}}');
|
|
1821
1553
|
expect(element.text()).toEqual("hello world");
|
|
1822
1554
|
expect($rootScope.greeting).toEqual("hello world");
|
|
@@ -1993,7 +1725,7 @@ describe("angular", () => {
|
|
|
1993
1725
|
body,
|
|
1994
1726
|
element,
|
|
1995
1727
|
];
|
|
1996
|
-
forEach(
|
|
1728
|
+
Object.entries(tests).forEach(([idx, value]) => {
|
|
1997
1729
|
const result = isElement(value);
|
|
1998
1730
|
expect(typeof result).toEqual("boolean");
|
|
1999
1731
|
expect(result).toEqual(expected[idx]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JQLite } from "../shared/jqlite/jqlite";
|
|
2
|
-
import {
|
|
2
|
+
import { isString } from "../shared/utils";
|
|
3
3
|
import { concatWithSpace, getDomNode } from "./shared";
|
|
4
4
|
|
|
5
5
|
const NG_ANIMATE_SHIM_CLASS_NAME = "ng-animate-shim";
|
|
@@ -211,7 +211,7 @@ export function AnimateCssDriverProvider($$animationProvider) {
|
|
|
211
211
|
animationRunners.push(toAnimation.start());
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
forEach(
|
|
214
|
+
anchorAnimations.forEach((animation) => {
|
|
215
215
|
animationRunners.push(animation.start());
|
|
216
216
|
});
|
|
217
217
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isDefined } from "../shared/utils";
|
|
2
2
|
import {
|
|
3
3
|
TRANSITION_DURATION_PROP,
|
|
4
4
|
TRANSITION_DELAY_PROP,
|
|
@@ -67,7 +67,7 @@ function getCssDelayStyle(delay, isKeyframeAnimation) {
|
|
|
67
67
|
function computeCssStyles(element, properties) {
|
|
68
68
|
const styles = Object.create(null);
|
|
69
69
|
const detectedStyles = window.getComputedStyle(element) || {};
|
|
70
|
-
forEach(
|
|
70
|
+
Object.entries(properties).forEach(([actualStyleName, formalStyleName]) => {
|
|
71
71
|
let val = detectedStyles[formalStyleName];
|
|
72
72
|
if (val) {
|
|
73
73
|
const c = val.charAt(0);
|
|
@@ -92,8 +92,7 @@ function computeCssStyles(element, properties) {
|
|
|
92
92
|
|
|
93
93
|
function parseMaxTime(str) {
|
|
94
94
|
let maxValue = 0;
|
|
95
|
-
|
|
96
|
-
forEach(values, (value) => {
|
|
95
|
+
str.split(/\s*,\s*/).forEach((value) => {
|
|
97
96
|
// it's always safe to consider only second values and omit `ms` values since
|
|
98
97
|
// getComputedStyle will always handle the conversion for us
|
|
99
98
|
if (value.charAt(value.length - 1) === "s") {
|
|
@@ -130,7 +129,7 @@ function getCssTransitionDurationStyle(duration, applyOnlyDuration) {
|
|
|
130
129
|
// is to be removed at the end of the animation). If we had a simple
|
|
131
130
|
// "OR" statement then it would not be enough to catch that.
|
|
132
131
|
function registerRestorableStyles(backup, node, properties) {
|
|
133
|
-
forEach(
|
|
132
|
+
properties.forEach((prop) => {
|
|
134
133
|
backup[prop] = isDefined(backup[prop])
|
|
135
134
|
? backup[prop]
|
|
136
135
|
: node.style.getPropertyValue(prop);
|
|
@@ -140,7 +139,6 @@ function registerRestorableStyles(backup, node, properties) {
|
|
|
140
139
|
export function AnimateCssProvider() {
|
|
141
140
|
this.$get = [
|
|
142
141
|
"$$AnimateRunner",
|
|
143
|
-
"$timeout",
|
|
144
142
|
"$$animateCache",
|
|
145
143
|
"$$rAFScheduler",
|
|
146
144
|
"$$animateQueue",
|
|
@@ -148,19 +146,12 @@ export function AnimateCssProvider() {
|
|
|
148
146
|
/**
|
|
149
147
|
*
|
|
150
148
|
* @param {*} $$AnimateRunner
|
|
151
|
-
* @param {*} $timeout
|
|
152
149
|
* @param {*} $$animateCache
|
|
153
150
|
* @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
|
|
154
151
|
* @param {*} $$animateQueue
|
|
155
152
|
* @returns
|
|
156
153
|
*/
|
|
157
|
-
function (
|
|
158
|
-
$$AnimateRunner,
|
|
159
|
-
$timeout,
|
|
160
|
-
$$animateCache,
|
|
161
|
-
$$rAFScheduler,
|
|
162
|
-
$$animateQueue,
|
|
163
|
-
) {
|
|
154
|
+
function ($$AnimateRunner, $$animateCache, $$rAFScheduler, $$animateQueue) {
|
|
164
155
|
const applyAnimationClasses = applyAnimationClassesFactory();
|
|
165
156
|
|
|
166
157
|
function computeCachedCssStyles(
|
|
@@ -599,7 +590,7 @@ export function AnimateCssProvider() {
|
|
|
599
590
|
blockKeyframeAnimations(node, false);
|
|
600
591
|
blockTransitions(node, false);
|
|
601
592
|
|
|
602
|
-
forEach(
|
|
593
|
+
temporaryStyles.forEach((entry) => {
|
|
603
594
|
// There is only one way to remove inline style properties entirely from elements.
|
|
604
595
|
// By using `removeProperty` this works, but we need to convert camel-cased CSS
|
|
605
596
|
// styles down to hyphenated values.
|
|
@@ -610,7 +601,7 @@ export function AnimateCssProvider() {
|
|
|
610
601
|
applyAnimationStyles(element, options);
|
|
611
602
|
|
|
612
603
|
if (Object.keys(restoreStyles).length) {
|
|
613
|
-
forEach(
|
|
604
|
+
Object.entries(restoreStyles).forEach(([prop, value]) => {
|
|
614
605
|
if (value) {
|
|
615
606
|
node.style.setProperty(prop, value);
|
|
616
607
|
} else {
|
|
@@ -636,7 +627,7 @@ export function AnimateCssProvider() {
|
|
|
636
627
|
// Cancel the fallback closing timeout and remove the timer data
|
|
637
628
|
const animationTimerData = element.data(ANIMATE_TIMER_KEY);
|
|
638
629
|
if (animationTimerData) {
|
|
639
|
-
|
|
630
|
+
clearTimeout(animationTimerData[0].timer);
|
|
640
631
|
element.removeData(ANIMATE_TIMER_KEY);
|
|
641
632
|
}
|
|
642
633
|
|
|
@@ -750,7 +741,7 @@ export function AnimateCssProvider() {
|
|
|
750
741
|
(timings.animationDuration && stagger.animationDuration === 0)) &&
|
|
751
742
|
Math.max(stagger.animationDelay, stagger.transitionDelay);
|
|
752
743
|
if (maxStagger) {
|
|
753
|
-
|
|
744
|
+
setTimeout(
|
|
754
745
|
triggerAnimationStart,
|
|
755
746
|
Math.floor(maxStagger * itemIndex * ONE_SECOND),
|
|
756
747
|
false,
|
|
@@ -775,7 +766,7 @@ export function AnimateCssProvider() {
|
|
|
775
766
|
|
|
776
767
|
applyBlocking(false);
|
|
777
768
|
|
|
778
|
-
forEach(
|
|
769
|
+
temporaryStyles.forEach((entry) => {
|
|
779
770
|
const key = entry[0];
|
|
780
771
|
const value = entry[1];
|
|
781
772
|
node.style[key] = value;
|
|
@@ -858,14 +849,14 @@ export function AnimateCssProvider() {
|
|
|
858
849
|
const currentTimerData = animationsData[0];
|
|
859
850
|
setupFallbackTimer = endTime > currentTimerData.expectedEndTime;
|
|
860
851
|
if (setupFallbackTimer) {
|
|
861
|
-
|
|
852
|
+
clearTimeout(currentTimerData.timer);
|
|
862
853
|
} else {
|
|
863
854
|
animationsData.push(close);
|
|
864
855
|
}
|
|
865
856
|
}
|
|
866
857
|
|
|
867
858
|
if (setupFallbackTimer) {
|
|
868
|
-
const timer =
|
|
859
|
+
const timer = setTimeout(onAnimationExpired, timerTime, false);
|
|
869
860
|
animationsData[0] = {
|
|
870
861
|
timer,
|
|
871
862
|
expectedEndTime: endTime,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { forEach } from "../shared/utils";
|
|
2
|
-
|
|
3
1
|
AnimateJsDriverProvider.$inject = ["$$animationProvider"];
|
|
4
2
|
export function AnimateJsDriverProvider($$animationProvider) {
|
|
5
3
|
$$animationProvider.drivers.push("$$animateJsDriver");
|
|
@@ -36,7 +34,7 @@ export function AnimateJsDriverProvider($$animationProvider) {
|
|
|
36
34
|
|
|
37
35
|
function endFnFactory() {
|
|
38
36
|
return function () {
|
|
39
|
-
forEach(
|
|
37
|
+
animationRunners.forEach((runner) => {
|
|
40
38
|
// at this point we cannot cancel animations for groups just yet. 1.5+
|
|
41
39
|
runner.end();
|
|
42
40
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isObject, isFunction } from "../shared/utils";
|
|
2
2
|
import {
|
|
3
3
|
applyAnimationClassesFactory,
|
|
4
4
|
applyAnimationStyles,
|
|
@@ -218,7 +218,7 @@ export function AnimateJsProvider($animateProvider) {
|
|
|
218
218
|
fnName,
|
|
219
219
|
) {
|
|
220
220
|
const operations = [];
|
|
221
|
-
forEach(
|
|
221
|
+
animations.forEach((ani) => {
|
|
222
222
|
const animation = ani[fnName];
|
|
223
223
|
if (!animation) return;
|
|
224
224
|
|
|
@@ -326,7 +326,7 @@ export function AnimateJsProvider($animateProvider) {
|
|
|
326
326
|
return function startAnimation(callback) {
|
|
327
327
|
const runners = [];
|
|
328
328
|
if (operations.length) {
|
|
329
|
-
forEach(
|
|
329
|
+
operations.forEach((animateFn) => {
|
|
330
330
|
runners.push(animateFn());
|
|
331
331
|
});
|
|
332
332
|
}
|
|
@@ -338,7 +338,7 @@ export function AnimateJsProvider($animateProvider) {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
return function endFn(reject) {
|
|
341
|
-
forEach(
|
|
341
|
+
runners.forEach((runner) => {
|
|
342
342
|
if (reject) {
|
|
343
343
|
runner.cancel();
|
|
344
344
|
} else {
|