@angular-wave/angular.ts 0.0.39 → 0.0.41
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 +2 -0
- package/README.md +2 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -1
- package/package.json +1 -1
- package/rollup.config.js +10 -5
- package/src/angular.spec.js +25 -26
- package/src/animations/animate-css-driver.js +3 -3
- package/src/animations/animate-queue.js +10 -7
- package/src/animations/animation.js +2 -2
- package/src/animations/shared.js +6 -6
- package/src/binding.spec.js +7 -7
- package/src/core/animate/animate.js +5 -5
- package/src/core/animate/animate.spec.js +31 -31
- package/src/core/cache/cache-factory.html +18 -0
- package/src/core/cache/{cache-factor.test.js → cache-factory.test.js} +1 -1
- package/src/core/compile/compile.js +33 -25
- package/src/core/compile/compile.md +2 -2
- package/src/core/compile/compile.spec.js +2 -43
- package/src/core/cookie-reader.spec.js +2 -2
- package/src/core/core.html +22 -0
- package/src/core/core.test.js +12 -0
- package/src/core/document.spec.js +4 -4
- package/src/core/exception-handler.js +30 -23
- package/src/core/interpolate/interpolate.js +7 -0
- package/src/core/{cache/cache-factor.html → location/location.html} +1 -1
- package/src/core/location/location.js +2 -2
- package/src/core/location/location.spec.js +17 -17
- package/src/core/location/location.test.js +12 -0
- package/src/core/on.spec.js +3 -3
- package/src/core/parser/parse.html +18 -0
- package/src/core/parser/parse.spec.js +1 -1
- package/src/core/parser/parse.test.js +12 -0
- package/src/core/prop.spec.js +3 -4
- package/src/core/pubsub/pubsub.html +18 -0
- package/src/core/pubsub/pubsub.spec.js +1 -1
- package/src/core/pubsub/pubsub.test.js +12 -0
- package/src/core/q/q.html +18 -0
- package/src/core/q/q.js +33 -0
- package/src/core/q/q.test.js +0 -0
- package/src/core/root-element.spec.js +4 -4
- package/src/core/sanitize/sanitize-uri.spec.js +1 -1
- package/src/core/sanitize/sanitize-uri.test.js +12 -0
- package/src/core/sanitize/sanitize.html +21 -0
- package/src/core/sce/sce.html +18 -0
- package/src/core/sce/sce.spec.js +2 -1
- package/src/core/sce/sce.test.js +12 -0
- package/src/core/scope/scope.html +18 -0
- package/src/core/scope/scope.js +1 -1
- package/src/core/scope/scope.spec.js +1 -1
- package/src/core/scope/scope.test.js +12 -0
- package/src/core/task-tracker-factory.js +9 -11
- package/src/core/timeout/timeout.html +18 -0
- package/src/core/timeout/timeout.js +9 -0
- package/src/core/timeout/timeout.spec.js +2 -2
- package/src/core/timeout/timout.test.js +12 -0
- package/src/core/url-utils/url-utils.html +18 -0
- package/src/core/url-utils/url-utils.spec.js +4 -2
- package/src/core/url-utils/url-utils.test.js +12 -0
- package/src/directive/attrs/attrs.spec.js +1 -2
- package/src/directive/attrs/boolean.spec.js +1 -2
- package/src/directive/attrs/element-style.spec.js +6 -7
- package/src/directive/attrs/src.spec.js +1 -2
- package/src/directive/bind/bind.spec.js +1 -2
- package/src/directive/class/class.spec.js +15 -16
- package/src/directive/cloak/cloak.spec.js +3 -4
- package/src/directive/controller/controller.spec.js +4 -5
- package/src/directive/events/click.spec.js +1 -2
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.js +7 -0
- package/src/directive/form/form.spec.js +17 -17
- package/src/directive/if/if.spec.js +2 -2
- package/src/directive/include/include.js +5 -7
- package/src/directive/include/include.spec.js +32 -32
- package/src/directive/init/init.spec.js +2 -3
- package/src/directive/input/input.spec.js +3 -3
- package/src/directive/list/list.spec.js +1 -2
- package/src/directive/model/model.js +13 -0
- package/src/directive/model/model.spec.js +4 -5
- package/src/directive/model-options/model-options.spec.js +3 -3
- package/src/directive/non-bindable/non-bindable.spec.js +1 -2
- package/src/directive/options/options.js +5 -5
- package/src/directive/options/options.spec.js +13 -13
- package/src/directive/ref/href.spec.js +1 -2
- package/src/directive/repeat/repeat.spec.js +12 -12
- package/src/directive/script/script.spec.js +2 -3
- package/src/directive/select/select.js +6 -6
- package/src/directive/select/select.spec.js +5 -5
- package/src/directive/show-hide/show-hide.spec.js +12 -13
- package/src/directive/style/style.spec.js +3 -4
- package/src/directive/switch/switch.spec.js +2 -3
- package/src/directive/validators/validators.spec.js +1 -1
- package/src/exts/aria/aria.spec.js +1 -2
- package/src/exts/messages/messages.spec.js +5 -5
- package/src/filters/filter.spec.js +5 -5
- package/src/filters/filters.html +21 -0
- package/src/filters/filters.spec.js +3 -3
- package/src/filters/filters.test.js +12 -0
- package/src/filters/limit-to.md +1 -1
- package/src/filters/limit-to.spec.js +4 -4
- package/src/filters/order-by.spec.js +2 -2
- package/src/index.js +186 -31
- package/src/loader.js +49 -11
- package/src/public.js +2 -3
- package/src/router/directives/state-directives.spec.js +90 -90
- package/src/router/directives/view-directive.js +2 -2
- package/src/router/directives/view-directive.spec.js +9 -9
- package/src/router/state/state.spec.js +2 -4
- package/src/router/template-factory.spec.js +2 -2
- package/src/router/transition/hook-registry.js +2 -2
- package/src/router/view/view.spec.js +1 -1
- package/src/services/browser.js +56 -39
- package/src/services/document.js +16 -13
- package/src/services/http/http.js +11 -7
- package/src/services/log.js +39 -43
- package/src/services/template-request.js +9 -0
- package/src/shared/common.js +0 -3
- package/src/shared/jqlite/jqlite.js +370 -355
- package/src/shared/jqlite/jqlite.spec.js +260 -272
- package/src/shared/strings.js +2 -2
- package/src/shared/test-utils.js +2 -2
- package/src/shared/utils.js +8 -11
- package/src/types.js +13 -0
- package/types/animations/shared.d.ts +7 -2
- package/types/core/compile/compile.d.ts +2 -1
- package/types/core/exception-handler.d.ts +9 -42
- package/types/core/interpolate/interpolate.d.ts +1 -1
- package/types/core/q/q.d.ts +35 -1
- package/types/core/task-tracker-factory.d.ts +18 -11
- package/types/core/timeout/timeout.d.ts +10 -1
- package/types/directive/include/include.d.ts +2 -2
- package/types/directive/model/model.d.ts +28 -4
- package/types/index.d.ts +664 -79
- package/types/services/browser.d.ts +50 -20
- package/types/services/document.d.ts +14 -9
- package/types/services/log.d.ts +37 -34
- package/types/services/template-request.d.ts +1 -1
- package/types/shared/common.d.ts +0 -1
- package/types/shared/jqlite/jqlite.d.ts +83 -22
- package/types/shared/utils.d.ts +22 -22
- package/types/types.d.ts +34 -0
- package/types-back/index.d.ts +0 -130
- package/types-back/jqlite.d.ts +1 -40
- /package/src/core/cache/{cache-factor.spec.js → cache-factory.spec.js} +0 -0
|
@@ -22,10 +22,10 @@ xdescribe("$animate", () => {
|
|
|
22
22
|
|
|
23
23
|
it("should enter the element to the start of the parent container", () => {
|
|
24
24
|
for (let i = 0; i < 5; i++) {
|
|
25
|
-
element.append(
|
|
25
|
+
element.append(JQLite(`<div> ${i}</div>`));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const child =
|
|
28
|
+
const child = JQLite("<div>first</div>");
|
|
29
29
|
$animate.enter(child, element);
|
|
30
30
|
|
|
31
31
|
expect(element.text()).toEqual("first 0 1 2 3 4");
|
|
@@ -70,9 +70,9 @@ xdescribe("$animate", () => {
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it("should run each method and return a promise", () => {
|
|
73
|
-
const element =
|
|
74
|
-
const move =
|
|
75
|
-
const parent =
|
|
73
|
+
const element = JQLite("<div></div>");
|
|
74
|
+
const move = JQLite("<div></div>");
|
|
75
|
+
const parent = JQLite($document[0].body);
|
|
76
76
|
parent.append(move);
|
|
77
77
|
|
|
78
78
|
expect($animate.enter(element, parent)).toBeAPromise();
|
|
@@ -95,7 +95,7 @@ xdescribe("$animate", () => {
|
|
|
95
95
|
|
|
96
96
|
it("should add and remove classes on SVG elements", () => {
|
|
97
97
|
if (!window.SVGElement) return;
|
|
98
|
-
const svg =
|
|
98
|
+
const svg = JQLite("<svg><rect></rect></svg>");
|
|
99
99
|
const rect = svg.children();
|
|
100
100
|
$animate.enabled(false);
|
|
101
101
|
expect(rect).toBeShown();
|
|
@@ -137,9 +137,9 @@ xdescribe("$animate", () => {
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
it("should apply and retain inline styles on the element that is animated", () => {
|
|
140
|
-
const element =
|
|
141
|
-
const parent =
|
|
142
|
-
const other =
|
|
140
|
+
const element = JQLite("<div></div>");
|
|
141
|
+
const parent = JQLite("<div></div>");
|
|
142
|
+
const other = JQLite("<div></div>");
|
|
143
143
|
parent.append(other);
|
|
144
144
|
$animate.enabled(true);
|
|
145
145
|
|
|
@@ -183,7 +183,7 @@ xdescribe("$animate", () => {
|
|
|
183
183
|
});
|
|
184
184
|
|
|
185
185
|
it("should merge the from and to styles that are provided", () => {
|
|
186
|
-
const element =
|
|
186
|
+
const element = JQLite("<div></div>");
|
|
187
187
|
|
|
188
188
|
element[0].style.color = "red";
|
|
189
189
|
$animate.addClass(element, "on", {
|
|
@@ -198,7 +198,7 @@ xdescribe("$animate", () => {
|
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
it("should avoid cancelling out add/remove when the element already contains the class", () => {
|
|
201
|
-
const element =
|
|
201
|
+
const element = JQLite('<div class="ng-hide"></div>');
|
|
202
202
|
|
|
203
203
|
$animate.addClass(element, "ng-hide");
|
|
204
204
|
$animate.removeClass(element, "ng-hide");
|
|
@@ -208,7 +208,7 @@ xdescribe("$animate", () => {
|
|
|
208
208
|
});
|
|
209
209
|
|
|
210
210
|
it("should avoid cancelling out remove/add if the element does not contain the class", () => {
|
|
211
|
-
const element =
|
|
211
|
+
const element = JQLite("<div></div>");
|
|
212
212
|
|
|
213
213
|
$animate.removeClass(element, "ng-hide");
|
|
214
214
|
$animate.addClass(element, "ng-hide");
|
|
@@ -219,7 +219,7 @@ xdescribe("$animate", () => {
|
|
|
219
219
|
|
|
220
220
|
["enter", "move"].forEach((method) => {
|
|
221
221
|
it('should accept an unwrapped "parent" element for the $prop event', () => {
|
|
222
|
-
const element =
|
|
222
|
+
const element = JQLite("<div></div>");
|
|
223
223
|
const parent = $document[0].createElement("div");
|
|
224
224
|
$rootElement.append(parent);
|
|
225
225
|
|
|
@@ -230,7 +230,7 @@ xdescribe("$animate", () => {
|
|
|
230
230
|
|
|
231
231
|
["enter", "move"].forEach((method) => {
|
|
232
232
|
it('should accept an unwrapped "after" element for the $prop event', () => {
|
|
233
|
-
const element =
|
|
233
|
+
const element = JQLite("<div></div>");
|
|
234
234
|
const after = $document[0].createElement("div");
|
|
235
235
|
$rootElement.append(after);
|
|
236
236
|
|
|
@@ -257,8 +257,8 @@ xdescribe("$animate", () => {
|
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
259
|
|
|
260
|
-
const element =
|
|
261
|
-
const parent2 =
|
|
260
|
+
const element = JQLite("<div></div>");
|
|
261
|
+
const parent2 = JQLite("<div></div>");
|
|
262
262
|
const parent = $rootElement;
|
|
263
263
|
parent.append(parent2);
|
|
264
264
|
|
|
@@ -327,7 +327,7 @@ xdescribe("$animate", () => {
|
|
|
327
327
|
() => {
|
|
328
328
|
const spy = spyOn(window, "jqLiteAddClass").and.callThrough();
|
|
329
329
|
|
|
330
|
-
const element =
|
|
330
|
+
const element = JQLite("<div></div>");
|
|
331
331
|
const parent = $rootElement;
|
|
332
332
|
|
|
333
333
|
$animate.enter(element, parent, null, { addClass: () => {} });
|
|
@@ -345,8 +345,8 @@ xdescribe("$animate", () => {
|
|
|
345
345
|
});
|
|
346
346
|
|
|
347
347
|
it("should not break postDigest for subsequent elements if addClass contains non-valid CSS class names", () => {
|
|
348
|
-
const element1 =
|
|
349
|
-
const element2 =
|
|
348
|
+
const element1 = JQLite("<div></div>");
|
|
349
|
+
const element2 = JQLite("<div></div>");
|
|
350
350
|
|
|
351
351
|
$animate.enter(element1, $rootElement, null, { addClass: " " });
|
|
352
352
|
$animate.enter(element2, $rootElement, null, { addClass: "valid-name" });
|
|
@@ -361,7 +361,7 @@ xdescribe("$animate", () => {
|
|
|
361
361
|
() => {
|
|
362
362
|
const spy = spyOn(window, "jqLiteRemoveClass").and.callThrough();
|
|
363
363
|
|
|
364
|
-
const element =
|
|
364
|
+
const element = JQLite("<div></div>");
|
|
365
365
|
const parent = $rootElement;
|
|
366
366
|
|
|
367
367
|
$animate.enter(element, parent, null, { removeClass: () => {} });
|
|
@@ -380,7 +380,7 @@ xdescribe("$animate", () => {
|
|
|
380
380
|
});
|
|
381
381
|
|
|
382
382
|
it("should not alter the provided options input in any way throughout the animation", () => {
|
|
383
|
-
const element =
|
|
383
|
+
const element = JQLite("<div></div>");
|
|
384
384
|
const parent = $rootElement;
|
|
385
385
|
|
|
386
386
|
const initialOptions = {
|
|
@@ -418,7 +418,7 @@ xdescribe("$animate", () => {
|
|
|
418
418
|
|
|
419
419
|
function setupClassManipulationLogger(log) {
|
|
420
420
|
() => {
|
|
421
|
-
const _addClass =
|
|
421
|
+
const _addClass = JQLiteAddClass;
|
|
422
422
|
addClass = spyOn(window, "jqLiteAddClass").and.callFake(
|
|
423
423
|
(element, classes) => {
|
|
424
424
|
let names = classes;
|
|
@@ -429,7 +429,7 @@ xdescribe("$animate", () => {
|
|
|
429
429
|
},
|
|
430
430
|
);
|
|
431
431
|
|
|
432
|
-
const _removeClass =
|
|
432
|
+
const _removeClass = JQLiteRemoveClass;
|
|
433
433
|
removeClass = spyOn(window, "jqLiteRemoveClass").and.callFake(
|
|
434
434
|
(element, classes) => {
|
|
435
435
|
let names = classes;
|
|
@@ -444,7 +444,7 @@ xdescribe("$animate", () => {
|
|
|
444
444
|
|
|
445
445
|
it("should defer class manipulation until end of digest", () => {
|
|
446
446
|
setupClassManipulationLogger(log);
|
|
447
|
-
element =
|
|
447
|
+
element = JQLite("<p>test</p>");
|
|
448
448
|
|
|
449
449
|
$rootScope.$apply(() => {
|
|
450
450
|
$animate.addClass(element, "test-class1");
|
|
@@ -472,7 +472,7 @@ xdescribe("$animate", () => {
|
|
|
472
472
|
|
|
473
473
|
it("should defer class manipulation until postDigest when outside of digest", () => {
|
|
474
474
|
setupClassManipulationLogger(log);
|
|
475
|
-
element =
|
|
475
|
+
element = JQLite('<p class="test-class4">test</p>');
|
|
476
476
|
|
|
477
477
|
$animate.addClass(element, "test-class1");
|
|
478
478
|
$animate.removeClass(element, "test-class1");
|
|
@@ -494,7 +494,7 @@ xdescribe("$animate", () => {
|
|
|
494
494
|
});
|
|
495
495
|
|
|
496
496
|
it("should perform class manipulation in expected order at end of digest", () => {
|
|
497
|
-
element =
|
|
497
|
+
element = JQLite('<p class="test-class3">test</p>');
|
|
498
498
|
|
|
499
499
|
setupClassManipulationLogger(log);
|
|
500
500
|
|
|
@@ -509,7 +509,7 @@ xdescribe("$animate", () => {
|
|
|
509
509
|
});
|
|
510
510
|
|
|
511
511
|
it("should return a promise which is resolved on a different turn", () => {
|
|
512
|
-
element =
|
|
512
|
+
element = JQLite('<p class="test2">test</p>');
|
|
513
513
|
|
|
514
514
|
$animate.addClass(element, "test1").then(log.fn("addClass(test1)"));
|
|
515
515
|
$animate.removeClass(element, "test2").then(log.fn("removeClass(test2)"));
|
|
@@ -521,7 +521,7 @@ xdescribe("$animate", () => {
|
|
|
521
521
|
expect(log).toEqual(["addClass(test1)", "removeClass(test2)"]);
|
|
522
522
|
|
|
523
523
|
log.reset();
|
|
524
|
-
element =
|
|
524
|
+
element = JQLite('<p class="test4">test</p>');
|
|
525
525
|
|
|
526
526
|
$rootScope.$apply(() => {
|
|
527
527
|
$animate.addClass(element, "test3").then(log.fn("addClass(test3)"));
|
|
@@ -538,7 +538,7 @@ xdescribe("$animate", () => {
|
|
|
538
538
|
it("should defer class manipulation until end of digest for SVG", () => {
|
|
539
539
|
if (!window.SVGElement) return;
|
|
540
540
|
setupClassManipulationSpies();
|
|
541
|
-
element =
|
|
541
|
+
element = JQLite("<svg><g></g></svg>");
|
|
542
542
|
const target = element.children().eq(0);
|
|
543
543
|
|
|
544
544
|
$rootScope.$apply(() => {
|
|
@@ -564,7 +564,7 @@ xdescribe("$animate", () => {
|
|
|
564
564
|
it("should defer class manipulation until postDigest when outside of digest for SVG", () => {
|
|
565
565
|
if (!window.SVGElement) return;
|
|
566
566
|
setupClassManipulationLogger(log);
|
|
567
|
-
element =
|
|
567
|
+
element = JQLite('<svg><g class="test-class4"></g></svg>');
|
|
568
568
|
const target = element.children().eq(0);
|
|
569
569
|
|
|
570
570
|
$animate.addClass(target, "test-class1");
|
|
@@ -588,7 +588,7 @@ xdescribe("$animate", () => {
|
|
|
588
588
|
|
|
589
589
|
it("should perform class manipulation in expected order at end of digest for SVG", () => {
|
|
590
590
|
if (!window.SVGElement) return;
|
|
591
|
-
element =
|
|
591
|
+
element = JQLite('<svg><g class="test-class3"></g></svg>');
|
|
592
592
|
const target = element.children().eq(0);
|
|
593
593
|
|
|
594
594
|
setupClassManipulationLogger(log);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS Test Runner</title>
|
|
6
|
+
|
|
7
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
|
+
<link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
|
|
9
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
|
|
10
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
|
+
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
|
+
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
+
<script type="module" src="/src/core/cache/cache-factory.spec.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="dummy"></div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
JQLite,
|
|
3
|
+
cleanElementData,
|
|
3
4
|
getBooleanAttrName,
|
|
5
|
+
getOrSetCacheData,
|
|
4
6
|
isTextNode,
|
|
5
7
|
startingTag,
|
|
6
8
|
} from "../../shared/jqlite/jqlite";
|
|
@@ -229,6 +231,12 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
229
231
|
$provide.factory(name + Suffix, [
|
|
230
232
|
"$injector",
|
|
231
233
|
"$exceptionHandler",
|
|
234
|
+
/**
|
|
235
|
+
*
|
|
236
|
+
* @param {*} $injector
|
|
237
|
+
* @param {import('../exception-handler').angular.ErrorHandler} $exceptionHandler
|
|
238
|
+
* @returns
|
|
239
|
+
*/
|
|
232
240
|
function ($injector, $exceptionHandler) {
|
|
233
241
|
const directives = [];
|
|
234
242
|
forEach(hasDirectives[name], (directiveFactory, index) => {
|
|
@@ -1001,11 +1009,11 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1001
1009
|
ignoreDirective,
|
|
1002
1010
|
previousCompileContext,
|
|
1003
1011
|
) {
|
|
1004
|
-
if (!($compileNodes instanceof
|
|
1012
|
+
if (!($compileNodes instanceof JQLite)) {
|
|
1005
1013
|
// jquery always rewraps, whereas we need to preserve the original selector so that we can
|
|
1006
1014
|
// modify it.
|
|
1007
1015
|
|
|
1008
|
-
$compileNodes =
|
|
1016
|
+
$compileNodes = JQLite($compileNodes);
|
|
1009
1017
|
}
|
|
1010
1018
|
|
|
1011
1019
|
/**
|
|
@@ -1066,14 +1074,14 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1066
1074
|
// might change, so we need to recreate the namespace adapted compileNodes
|
|
1067
1075
|
// for call to the link function.
|
|
1068
1076
|
// Note: This will already clone the nodes...
|
|
1069
|
-
$linkNode =
|
|
1077
|
+
$linkNode = JQLite(
|
|
1070
1078
|
wrapTemplate(
|
|
1071
1079
|
namespace,
|
|
1072
|
-
|
|
1080
|
+
JQLite("<div></div>").append($compileNodes).html(),
|
|
1073
1081
|
),
|
|
1074
1082
|
);
|
|
1075
1083
|
} else if (cloneConnectFn) {
|
|
1076
|
-
$linkNode =
|
|
1084
|
+
$linkNode = JQLite(
|
|
1077
1085
|
Array.from($compileNodes).map((element) =>
|
|
1078
1086
|
element.cloneNode(true),
|
|
1079
1087
|
),
|
|
@@ -1128,8 +1136,8 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1128
1136
|
* @param {function(ng.IScope, cloneAttachFn=)} transcludeFn A linking function, where the
|
|
1129
1137
|
* scope argument is auto-generated to the new child of the transcluded parent scope.
|
|
1130
1138
|
* @param {Element=} $rootElement If the nodeList is the root of the compilation tree then
|
|
1131
|
-
* the rootElement must be set the
|
|
1132
|
-
* needed so that the
|
|
1139
|
+
* the rootElement must be set the JQLite collection of the compile root. This is
|
|
1140
|
+
* needed so that the JQLite collection items can be replaced with widgets.
|
|
1133
1141
|
* @param {number=} maxPriority Max directive priority.
|
|
1134
1142
|
* @returns {Function} A composite linking function of all of the matched directives or null.
|
|
1135
1143
|
*/
|
|
@@ -1510,7 +1518,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1510
1518
|
nodes.push(node);
|
|
1511
1519
|
}
|
|
1512
1520
|
|
|
1513
|
-
return
|
|
1521
|
+
return JQLite(nodes);
|
|
1514
1522
|
}
|
|
1515
1523
|
|
|
1516
1524
|
/**
|
|
@@ -1595,7 +1603,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1595
1603
|
* scope argument is auto-generated to the new
|
|
1596
1604
|
* child of the transcluded parent scope.
|
|
1597
1605
|
* @param {JQLite} jqCollection If we are working on the root of the compile tree then this
|
|
1598
|
-
* argument has the root
|
|
1606
|
+
* argument has the root JQLite array so that we can replace nodes
|
|
1599
1607
|
* on it.
|
|
1600
1608
|
* @param {Object=} originalReplaceDirective An optional directive that will be ignored when
|
|
1601
1609
|
* compiling the transclusion.
|
|
@@ -1627,7 +1635,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1627
1635
|
let hasTranscludeDirective = false;
|
|
1628
1636
|
let hasTemplate = false;
|
|
1629
1637
|
let { hasElementTranscludeDirective } = previousCompileContext;
|
|
1630
|
-
let $compileNode = (templateAttrs.$$element =
|
|
1638
|
+
let $compileNode = (templateAttrs.$$element = JQLite(compileNode));
|
|
1631
1639
|
let directive;
|
|
1632
1640
|
let directiveName;
|
|
1633
1641
|
let $template;
|
|
@@ -1755,7 +1763,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1755
1763
|
hasElementTranscludeDirective = true;
|
|
1756
1764
|
terminalPriority = directive.priority;
|
|
1757
1765
|
$template = $compileNode;
|
|
1758
|
-
$compileNode = templateAttrs.$$element =
|
|
1766
|
+
$compileNode = templateAttrs.$$element = JQLite(
|
|
1759
1767
|
document.createComment(""),
|
|
1760
1768
|
);
|
|
1761
1769
|
compileNode = $compileNode[0];
|
|
@@ -1813,7 +1821,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1813
1821
|
|
|
1814
1822
|
// Add the matching elements into their slot
|
|
1815
1823
|
|
|
1816
|
-
forEach(
|
|
1824
|
+
forEach(JQLite($compileNode[0].childNodes), (node) => {
|
|
1817
1825
|
const slotName = slotMap[directiveNormalize(nodeName_(node))];
|
|
1818
1826
|
if (slotName) {
|
|
1819
1827
|
filledSlots[slotName] = true;
|
|
@@ -1840,7 +1848,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1840
1848
|
for (const slotName in slots) {
|
|
1841
1849
|
if (slots[slotName]) {
|
|
1842
1850
|
// Only define a transclusion function if the slot was filled
|
|
1843
|
-
const slotCompileNodes =
|
|
1851
|
+
const slotCompileNodes = JQLite(slots[slotName].childNodes);
|
|
1844
1852
|
slots[slotName] = compilationGenerator(
|
|
1845
1853
|
mightHaveMultipleTransclusionError,
|
|
1846
1854
|
slotCompileNodes,
|
|
@@ -1849,7 +1857,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1849
1857
|
}
|
|
1850
1858
|
}
|
|
1851
1859
|
|
|
1852
|
-
$template =
|
|
1860
|
+
$template = JQLite($template.childNodes);
|
|
1853
1861
|
}
|
|
1854
1862
|
|
|
1855
1863
|
$compileNode.empty(); // clear contents
|
|
@@ -2076,7 +2084,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2076
2084
|
attrs = templateAttrs;
|
|
2077
2085
|
$element = templateAttrs.$$element;
|
|
2078
2086
|
} else {
|
|
2079
|
-
$element =
|
|
2087
|
+
$element = JQLite(linkNode);
|
|
2080
2088
|
attrs = new Attributes($element, templateAttrs);
|
|
2081
2089
|
}
|
|
2082
2090
|
|
|
@@ -2714,7 +2722,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2714
2722
|
}
|
|
2715
2723
|
replaceWith(
|
|
2716
2724
|
linkRootElement,
|
|
2717
|
-
|
|
2725
|
+
JQLite(beforeTemplateLinkNode),
|
|
2718
2726
|
linkNode,
|
|
2719
2727
|
);
|
|
2720
2728
|
|
|
@@ -3044,12 +3052,12 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
3044
3052
|
}
|
|
3045
3053
|
|
|
3046
3054
|
/**
|
|
3047
|
-
* This is a special
|
|
3048
|
-
* have no parents, provided that the containing
|
|
3055
|
+
* This is a special JQLite.replaceWith, which can replace items which
|
|
3056
|
+
* have no parents, provided that the containing JQLite collection is provided.
|
|
3049
3057
|
*
|
|
3050
3058
|
* @param {JQLite} $rootElement The root of the compile tree. Used so that we can replace nodes
|
|
3051
3059
|
* in the root of the tree.
|
|
3052
|
-
* @param {JQLite} elementsToRemove The
|
|
3060
|
+
* @param {JQLite} elementsToRemove The JQLite element which we are going to replace. We keep
|
|
3053
3061
|
* the shell, but replace its DOM node reference.
|
|
3054
3062
|
* @param {Node} newNode The new DOM node.
|
|
3055
3063
|
*/
|
|
@@ -3105,17 +3113,17 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
3105
3113
|
// Copy over user data (that includes AngularJS's $scope etc.). Don't copy private
|
|
3106
3114
|
// data here because there's no public interface in jQuery to do that and copying over
|
|
3107
3115
|
// event listeners (which is the main use of private data) wouldn't work anyway.
|
|
3108
|
-
|
|
3116
|
+
getOrSetCacheData(newNode, getOrSetCacheData(firstElementToRemove));
|
|
3109
3117
|
|
|
3110
3118
|
// Remove $destroy event listeners from `firstElementToRemove`
|
|
3111
|
-
|
|
3119
|
+
JQLite(firstElementToRemove).off("$destroy");
|
|
3112
3120
|
}
|
|
3113
3121
|
|
|
3114
3122
|
// Cleanup any data/listeners on the elements and children.
|
|
3115
3123
|
// This includes invoking the $destroy event on any elements with listeners.
|
|
3116
|
-
|
|
3124
|
+
cleanElementData(fragment.querySelectorAll("*"));
|
|
3117
3125
|
|
|
3118
|
-
// Update the
|
|
3126
|
+
// Update the JQLite collection to only contain the `newNode`
|
|
3119
3127
|
for (i = 1; i < removeCount; i++) {
|
|
3120
3128
|
delete elementsToRemove[i];
|
|
3121
3129
|
}
|
|
@@ -3402,7 +3410,7 @@ function tokenDifference(str1, str2) {
|
|
|
3402
3410
|
}
|
|
3403
3411
|
|
|
3404
3412
|
function removeComments(jqNodes) {
|
|
3405
|
-
jqNodes =
|
|
3413
|
+
jqNodes = JQLite(jqNodes);
|
|
3406
3414
|
let i = jqNodes.length;
|
|
3407
3415
|
|
|
3408
3416
|
if (i <= 1) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
-
|
|
6
6
|
- - "node" - DOM Node
|
|
7
7
|
- - "element" - DOM Element or Node
|
|
8
|
-
- - "$node" or "$element" -
|
|
8
|
+
- - "$node" or "$element" - JQLite-wrapped node or element
|
|
9
9
|
-
|
|
10
10
|
-
|
|
11
11
|
- Compiler related stuff:
|
|
@@ -728,7 +728,7 @@
|
|
|
728
728
|
- </div>
|
|
729
729
|
-
|
|
730
730
|
- If you want to manually control the insertion and removal of the transcluded content in your directive
|
|
731
|
-
- then you must use this transclude function. When you call a transclude function it returns a
|
|
731
|
+
- then you must use this transclude function. When you call a transclude function it returns a JQLite/JQuery
|
|
732
732
|
- object that contains the compiled DOM, which is linked to the correct transclusion scope.
|
|
733
733
|
-
|
|
734
734
|
- When you call a transclusion function you can pass in a **clone attach function**. This function accepts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { publishExternalAPI } from "../../public";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
|
-
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
3
|
+
import { dealoc, JQLite, getOrSetCacheData } from "../../shared/jqlite/jqlite";
|
|
4
4
|
import {
|
|
5
5
|
forEach,
|
|
6
6
|
isFunction,
|
|
@@ -6416,47 +6416,6 @@ describe("$compile", () => {
|
|
|
6416
6416
|
expect(element.text()).toEqual("3==3");
|
|
6417
6417
|
});
|
|
6418
6418
|
|
|
6419
|
-
describe("when directive is in a repeater", () => {
|
|
6420
|
-
let is;
|
|
6421
|
-
beforeEach(() => {
|
|
6422
|
-
is = [1, 2];
|
|
6423
|
-
});
|
|
6424
|
-
|
|
6425
|
-
function runTest() {
|
|
6426
|
-
$templateCache.put(
|
|
6427
|
-
"/mock/hello",
|
|
6428
|
-
"<span>i=<span ng-transclude></span>;</span>",
|
|
6429
|
-
);
|
|
6430
|
-
element = JQLite(
|
|
6431
|
-
`<div><b hello ng-repeat="i in [${is}]">{{i}}</b></div>`,
|
|
6432
|
-
);
|
|
6433
|
-
$compile(element)($rootScope);
|
|
6434
|
-
$rootScope.$digest();
|
|
6435
|
-
expect(element.text()).toEqual(`i=${is.join(";i=")};`);
|
|
6436
|
-
}
|
|
6437
|
-
|
|
6438
|
-
it("should work with another library patching JQLite/jQuery.cleanData after Angular", () => {
|
|
6439
|
-
let cleanedCount = 0;
|
|
6440
|
-
const currentCleanData = JQLite.cleanData;
|
|
6441
|
-
JQLite.cleanData = function (elems) {
|
|
6442
|
-
cleanedCount += elems.length;
|
|
6443
|
-
// Don't return the output and explicitly pass only the first parameter
|
|
6444
|
-
// so that we're sure we're not relying on either of them. jQuery UI patch
|
|
6445
|
-
// behaves in this way.
|
|
6446
|
-
currentCleanData(elems);
|
|
6447
|
-
};
|
|
6448
|
-
|
|
6449
|
-
runTest();
|
|
6450
|
-
|
|
6451
|
-
// The initial ng-repeat div is dumped after parsing hence we expect cleanData
|
|
6452
|
-
// count to be one larger than size of the iterated array.
|
|
6453
|
-
expect(cleanedCount).toBe(is.length + 1);
|
|
6454
|
-
|
|
6455
|
-
// Restore the previous cleanData.
|
|
6456
|
-
JQLite.cleanData = currentCleanData;
|
|
6457
|
-
});
|
|
6458
|
-
});
|
|
6459
|
-
|
|
6460
6419
|
describe("replace and not exactly one root element", () => {
|
|
6461
6420
|
beforeEach(() => {
|
|
6462
6421
|
publishExternalAPI().decorator("$exceptionHandler", () => {
|
|
@@ -17331,7 +17290,7 @@ describe("$compile", () => {
|
|
|
17331
17290
|
|
|
17332
17291
|
const preCompiledChildren = getAll(toCompile);
|
|
17333
17292
|
forEach(preCompiledChildren, (element, i) => {
|
|
17334
|
-
|
|
17293
|
+
getOrSetCacheData(element, "foo", `template#${i}`);
|
|
17335
17294
|
});
|
|
17336
17295
|
|
|
17337
17296
|
const linkedElements = $compile(toCompile)($rootScope);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS Test Runner</title>
|
|
6
|
+
|
|
7
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
|
+
<link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
|
|
9
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
|
|
10
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
|
+
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
|
+
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
+
<script type="module" src="/src/core/cookie-reader.spec.js"></script>
|
|
14
|
+
<script type="module" src="/src/core/document.spec.js"></script>
|
|
15
|
+
<script type="module" src="/src/core/on.spec.js"></script>
|
|
16
|
+
<script type="module" src="/src/core/prop.spec.js"></script>
|
|
17
|
+
<script type="module" src="/src/core/root-element.spec.js"></script>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="dummy"></div>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
const TEST_URL = "src/core/core.html";
|
|
4
|
+
|
|
5
|
+
test("unit tests contain no errors", async ({ page }) => {
|
|
6
|
+
await page.goto(TEST_URL);
|
|
7
|
+
await page.content();
|
|
8
|
+
await page.waitForTimeout(100);
|
|
9
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
10
|
+
/0 failures/,
|
|
11
|
+
);
|
|
12
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { publishExternalAPI } from "
|
|
2
|
-
import { createInjector } from "
|
|
3
|
-
import {
|
|
1
|
+
import { publishExternalAPI } from "../public";
|
|
2
|
+
import { createInjector } from "../injector";
|
|
3
|
+
import { JQLite } from "../shared/jqlite/jqlite";
|
|
4
4
|
|
|
5
5
|
describe("$document", () => {
|
|
6
6
|
let $document, $httpBackend, $http, $$isDocumentHidden;
|
|
@@ -15,7 +15,7 @@ describe("$document", () => {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should inject $document", () => {
|
|
18
|
-
expect($document).toEqual(
|
|
18
|
+
expect($document).toEqual(JQLite(window.document));
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
1
|
/**
|
|
3
|
-
* @ngdoc service
|
|
4
2
|
* @name $exceptionHandler
|
|
5
|
-
* @requires ng.$log
|
|
6
|
-
*
|
|
7
3
|
*
|
|
8
4
|
* @description
|
|
9
5
|
* Any uncaught exception in AngularJS expressions is delegated to this service.
|
|
@@ -29,35 +25,46 @@
|
|
|
29
25
|
* ```
|
|
30
26
|
*
|
|
31
27
|
* <hr />
|
|
32
|
-
* Note, that code executed in event-listeners (even those registered using
|
|
33
|
-
* methods) does not delegate exceptions to the {@link
|
|
28
|
+
* Note, that code executed in event-listeners (even those registered using JQLite's `on`/`bind`
|
|
29
|
+
* methods) does not delegate exceptions to the {@link angular.ErrorHandler }
|
|
34
30
|
* (unless executed during a digest).
|
|
35
31
|
*
|
|
36
32
|
* If you wish, you can manually delegate exceptions, e.g.
|
|
37
33
|
* `try { ... } catch(e) { $exceptionHandler(e); }`
|
|
38
34
|
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @typedef {import('../index').angular.ServiceProvider} angular.ExceptionHandlerProvider
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/** @type {import('../services/log').angular.LogService} */
|
|
42
|
+
let log;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @callback angular.ErrorHandler
|
|
46
|
+
* @param {Error} exception - Exception associated with the error.
|
|
47
|
+
* @param {string} [cause] - Optional information about the context in which the error was thrown.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
export const errorHandler = (exception, cause) => {
|
|
51
|
+
log.error(exception, cause);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @constructor
|
|
56
|
+
* @this {angular.ExceptionHandlerProvider}
|
|
43
57
|
*/
|
|
44
58
|
export function $ExceptionHandlerProvider() {
|
|
45
59
|
this.$get = [
|
|
46
60
|
"$log",
|
|
61
|
+
/**
|
|
62
|
+
* @param {import('../services/log').angular.LogService} $log
|
|
63
|
+
* @returns {angular.ErrorHandler}
|
|
64
|
+
*/
|
|
47
65
|
function ($log) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
66
|
+
log = $log;
|
|
67
|
+
return errorHandler;
|
|
51
68
|
},
|
|
52
69
|
];
|
|
53
70
|
}
|
|
54
|
-
|
|
55
|
-
// let $log;
|
|
56
|
-
|
|
57
|
-
// export function ExceptionHandler(log) {
|
|
58
|
-
// $log = log || window.console;
|
|
59
|
-
|
|
60
|
-
// return function(exception, cause) {
|
|
61
|
-
// $log.error.apply($log, arguments);
|
|
62
|
-
// };
|
|
63
|
-
// }
|