Skip to content

Commit 471c4ee

Browse files
committed
feat(collapse): Set display none when collapsed
This takes the element out of rendering to speed things up.
1 parent 76e3c5d commit 471c4ee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/collapse/collapse.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition'])
4949
if (initialAnimSkip) {
5050
initialAnimSkip = false;
5151
if ( !isCollapsed ) {
52+
element.css('display', '');
5253
fixUpHeight(scope, element, 'auto');
5354
element.addClass('in');
5455
}
5556
} else {
57+
element.css('display', '');
5658
doTransition({ height : element[0].scrollHeight + 'px' })
5759
.then(function() {
5860
// This check ensures that we don't accidentally update the height if the user has closed
@@ -72,9 +74,12 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition'])
7274
if (initialAnimSkip) {
7375
initialAnimSkip = false;
7476
fixUpHeight(scope, element, 0);
77+
element.css('display', 'none');
7578
} else {
7679
fixUpHeight(scope, element, element[0].scrollHeight + 'px');
77-
doTransition({'height':'0'});
80+
doTransition({'height':'0'}).then(function () {
81+
element.css('display', 'none');
82+
});
7883
}
7984
};
8085
}

0 commit comments

Comments
 (0)