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/directive | |
| 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/directive')
| -rw-r--r-- | src/ng/directive/ngTransclude.js | 2 | ||||
| -rw-r--r-- | src/ng/directive/select.js | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js index 490ea21f..8eefb6ff 100644 --- a/src/ng/directive/ngTransclude.js +++ b/src/ng/directive/ngTransclude.js @@ -69,7 +69,7 @@ var ngTranscludeDirective = ngDirective({ link: function($scope, $element, $attrs, controller) { controller.$transclude(function(clone) { - $element.html(''); + $element.empty(); $element.append(clone); }); } diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 86e04242..d87fa5d3 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -333,13 +333,13 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { // becomes the compilation root nullOption.removeClass('ng-scope'); - // we need to remove it before calling selectElement.html('') because otherwise IE will + // we need to remove it before calling selectElement.empty() because otherwise IE will // remove the label from the element. wtf? nullOption.remove(); } // clear contents, we'll add what's needed based on the model - selectElement.html(''); + selectElement.empty(); selectElement.on('change', function() { scope.$apply(function() { |
