From 3410f65e790a81d457b4f4601a1e760a6f8ede5e Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski Date: Wed, 16 Oct 2013 15:15:21 +0200 Subject: perf(jqLite): implement and use the `empty` method in place of `html(‘’)` jQuery's elem.html('') is way slower than elem.empty(). As clearing element contents happens quite often in certain scenarios, switching to using .empty() provides a significant performance boost when using Angular with jQuery. Closes #4457 --- test/ng/directive/ngIncludeSpec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/ng/directive/ngIncludeSpec.js') diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js index 9e0a47b0..79e7f312 100644 --- a/test/ng/directive/ngIncludeSpec.js +++ b/test/ng/directive/ngIncludeSpec.js @@ -47,7 +47,7 @@ describe('ngInclude', function() { $rootScope.url = 'myUrl'; $rootScope.$digest(); expect(body.text()).toEqual('misko'); - body.html(''); + body.empty(); })); @@ -60,7 +60,7 @@ describe('ngInclude', function() { $rootScope.url = 'myUrl'; $rootScope.$digest(); expect(element.text()).toEqual('Alibaba'); - jqLite(document.body).html(''); + jqLite(document.body).empty(); })); @@ -74,7 +74,7 @@ describe('ngInclude', function() { expect(function() { $rootScope.$digest(); }).toThrowMinErr( '$sce', 'insecurl', /Blocked loading resource from url not allowed by \$sceDelegate policy. URL: http:\/\/example.com\/myUrl.*/); - jqLite(document.body).html(''); + jqLite(document.body).empty(); })); @@ -88,7 +88,7 @@ describe('ngInclude', function() { expect(function() { $rootScope.$digest(); }).toThrowMinErr( '$sce', 'insecurl', /Blocked loading resource from url not allowed by \$sceDelegate policy. URL: http:\/\/example.com\/myUrl.*/); - jqLite(document.body).html(''); + jqLite(document.body).empty(); })); -- cgit v1.2.3