diff options
| author | Michał Gołębiowski | 2013-10-16 15:15:21 +0200 | 
|---|---|---|
| committer | Igor Minar | 2013-12-13 02:07:11 -0800 | 
| commit | 3410f65e790a81d457b4f4601a1e760a6f8ede5e (patch) | |
| tree | 2f37146f1399d23ea02de44e8209879eda949e1f /src/ng/compile.js | |
| parent | f3de5b6eac90baf649506072162f36dbc6d2f028 (diff) | |
| download | angular.js-3410f65e790a81d457b4f4601a1e760a6f8ede5e.tar.bz2 | |
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
Diffstat (limited to 'src/ng/compile.js')
| -rw-r--r-- | src/ng/compile.js | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/src/ng/compile.js b/src/ng/compile.js index a6bcc3e7..0af76a75 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1219,7 +1219,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {                                          });            } else {              $template = jqLite(jqLiteClone(compileNode)).contents(); -            $compileNode.html(''); // clear contents +            $compileNode.empty(); // clear contents              childTranscludeFn = compile($template, transcludeFn);            }          } @@ -1651,7 +1651,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {                ? origAsyncDirective.templateUrl($compileNode, tAttrs)                : origAsyncDirective.templateUrl; -      $compileNode.html(''); +      $compileNode.empty();        $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).          success(function(content) { | 
