@@ -13,7 +13,7 @@ import {
1313 extend,
1414} from "../../shared/utils.js";
1515import { countChildScopes, countWatchers } from "../scope/scope.js";
16- import { CACHE , EXPANDO } from "../cache/cache.js";
16+ import { Cache , EXPANDO } from "../cache/cache.js";
1717import { wait } from "../../shared/test-utils";
1818
1919function isUnknownElement(el) {
@@ -4903,36 +4903,36 @@ describe("$compile", () => {
49034903 // We compile the contents of element (i.e. not element itself)
49044904 // Then delete these contents and check the cache has been reset to zero
49054905 // Clear cache
4906- CACHE .clear();
4906+ Cache .clear();
49074907 window.angular.module("test1", ["ng"]);
49084908 createInjector(["test1"]).invoke(($compile) => {
4909- expect(CACHE .size).toEqual(0);
4909+ expect(Cache .size).toEqual(0);
49104910 // First with only elements at the top level
49114911 element = JQLite("<div><div></div></div>");
49124912 $compile(element[0].childNodes)($rootScope);
4913- // expect(CACHE .size).toEqual(2);
4913+ // expect(Cache .size).toEqual(2);
49144914 element.empty();
4915- expect(CACHE .size).toEqual(0);
4915+ expect(Cache .size).toEqual(0);
49164916
49174917 // Next with non-empty text nodes at the top level
49184918 // (in this case the compiler will wrap them in a <span>)
49194919 element = JQLite("<div>xxx</div>");
49204920 $compile(element[0].childNodes)($rootScope);
49214921 element.empty();
4922- expect(CACHE .size).toEqual(0);
4922+ expect(Cache .size).toEqual(0);
49234923
49244924 // Next with comment nodes at the top level
49254925 element = JQLite("<div><!-- comment --></div>");
49264926 $compile(element[0].childNodes)($rootScope);
49274927 element.empty();
4928- expect(CACHE .size).toEqual(0);
4928+ expect(Cache .size).toEqual(0);
49294929
49304930 // Finally with empty text nodes at the top level
49314931 element = JQLite("<div> \n<div></div> </div>");
49324932 $compile(element[0].childNodes)($rootScope);
4933- //expect(CACHE .size).toEqual(2);
4933+ //expect(Cache .size).toEqual(2);
49344934 element.empty();
4935- expect(CACHE .size).toEqual(0);
4935+ expect(Cache .size).toEqual(0);
49364936 });
49374937 });
49384938
@@ -13303,49 +13303,49 @@ describe("$compile", () => {
1330313303 });
1330413304
1330513305 it('should not leak if two "element" transclusions are on the same element', () => {
13306- const cacheSize = CACHE .size;
13306+ const cacheSize = Cache .size;
1330713307
1330813308 element = $compile(
1330913309 '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>',
1331013310 )($rootScope);
13311- expect(CACHE .size).toEqual(cacheSize);
13311+ expect(Cache .size).toEqual(cacheSize);
1331213312
1331313313 $rootScope.$apply("xs = [0,1]");
13314- expect(CACHE .size).toEqual(cacheSize);
13314+ expect(Cache .size).toEqual(cacheSize);
1331513315
1331613316 $rootScope.$apply("xs = [0]");
13317- expect(CACHE .size).toEqual(cacheSize);
13317+ expect(Cache .size).toEqual(cacheSize);
1331813318
1331913319 $rootScope.$apply("xs = []");
13320- expect(CACHE .size).toEqual(cacheSize);
13320+ expect(Cache .size).toEqual(cacheSize);
1332113321
1332213322 element.remove();
13323- expect(CACHE .size).toEqual(cacheSize);
13323+ expect(Cache .size).toEqual(cacheSize);
1332413324 });
1332513325
1332613326 it('should not leak if two "element" transclusions are on the same element', () => {
13327- const cacheSize = CACHE .size;
13327+ const cacheSize = Cache .size;
1332813328 element = $compile(
1332913329 '<div><div ng-repeat="x in xs" ng-if="val">{{x}}</div></div>',
1333013330 )($rootScope);
1333113331
1333213332 $rootScope.$apply("xs = [0,1]");
1333313333 // At this point we have a bunch of comment placeholders but no real transcluded elements
1333413334 // So the cache only contains the root element's data
13335- expect(CACHE .size).toEqual(cacheSize);
13335+ expect(Cache .size).toEqual(cacheSize);
1333613336
1333713337 $rootScope.$apply("val = true");
1333813338 // Now we have two concrete transcluded elements plus some comments so two more cache items
13339- expect(CACHE .size).toEqual(cacheSize);
13339+ expect(Cache .size).toEqual(cacheSize);
1334013340
1334113341 $rootScope.$apply("val = false");
1334213342 // Once again we only have comments so no transcluded elements and the cache is back to just
1334313343 // the root element
13344- expect(CACHE .size).toEqual(cacheSize);
13344+ expect(Cache .size).toEqual(cacheSize);
1334513345
1334613346 element.remove();
1334713347 // Now we've even removed the root element along with its cache
13348- expect(CACHE .size).toEqual(cacheSize);
13348+ expect(Cache .size).toEqual(cacheSize);
1334913349 });
1335013350
1335113351 // it("should not leak when continuing the compilation of elements on a scope that was destroyed", () => {
@@ -13370,7 +13370,7 @@ describe("$compile", () => {
1337013370 // link: linkFn,
1337113371 // }));
1337213372 // initInjector("test1");
13373- // const cacheSize = CACHE .size;
13373+ // const cacheSize = Cache .size;
1337413374 // $templateCache.set("red.html", "<p>red</p>");
1337513375 // const template = $compile(
1337613376 // '<div ng-controller="Leak">' +
@@ -13385,7 +13385,7 @@ describe("$compile", () => {
1338513385 // $rootScope.$digest();
1338613386
1338713387 // expect(linkFn).toHaveBeenCalled();
13388- // expect(CACHE .size).toEqual(cacheSize + 2);
13388+ // expect(Cache .size).toEqual(cacheSize + 2);
1338913389
1339013390 // $templateCache = new Map();
1339113391 // const destroyedScope = $rootScope.$new();
@@ -13414,7 +13414,7 @@ describe("$compile", () => {
1341413414 $rootScope.$apply(`xs = [${xs}]`);
1341513415 firstRepeatedElem = element.children(".ng-scope").eq(0);
1341613416
13417- privateData = CACHE .get(firstRepeatedElem[0][EXPANDO]);
13417+ privateData = Cache .get(firstRepeatedElem[0][EXPANDO]);
1341813418 expect(privateData.events).toBeDefined();
1341913419
1342013420 expect(privateData.events.click).toBeDefined();
@@ -13430,7 +13430,7 @@ describe("$compile", () => {
1343013430
1343113431 expect(destroyCount).toBe(2);
1343213432 expect(firstRepeatedElem.data("$scope")).not.toBeDefined();
13433- privateData = CACHE .get(firstRepeatedElem[0][EXPANDO]);
13433+ privateData = Cache .get(firstRepeatedElem[0][EXPANDO]);
1343413434 expect(privateData && privateData.events).not.toBeDefined();
1343513435 }
1343613436
@@ -14290,7 +14290,7 @@ describe("$compile", () => {
1429014290
1429114291 it("should not leak memory with nested transclusion", () => {
1429214292 let size;
14293- const initialSize = CACHE .size;
14293+ const initialSize = Cache .size;
1429414294
1429514295 element = JQLite(
1429614296 '<div><ul><li ng-repeat="n in nums">{{n}} => <i ng-if="0 === n%2">Even</i><i ng-if="1 === n%2">Odd</i></li></ul></div>',
@@ -14299,14 +14299,14 @@ describe("$compile", () => {
1429914299
1430014300 $rootScope.nums = [0, 1, 2];
1430114301 $rootScope.$apply();
14302- size = CACHE .size;
14302+ size = Cache .size;
1430314303
1430414304 $rootScope.nums = [3, 4, 5];
1430514305 $rootScope.$apply();
14306- expect(CACHE .size).toEqual(size);
14306+ expect(Cache .size).toEqual(size);
1430714307
1430814308 element.remove();
14309- expect(CACHE .size).toEqual(initialSize);
14309+ expect(Cache .size).toEqual(initialSize);
1431014310 });
1431114311 });
1431214312
0 commit comments