This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,26 +45,27 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition'])
4545 return currentTransition ;
4646 } ;
4747
48- var expand = function ( ) {
48+ var expand = function ( ) {
49+ isCollapsed = false ;
4950 if ( initialAnimSkip ) {
5051 initialAnimSkip = false ;
51- if ( ! isCollapsed ) {
52- fixUpHeight ( scope , element , 'auto' ) ;
53- element . addClass ( 'in' ) ;
54- }
52+ expandDone ( ) ;
5553 } else {
56- doTransition ( { height : element [ 0 ] . scrollHeight + 'px' } )
57- . then ( function ( ) {
58- // This check ensures that we don't accidentally update the height if the user has closed
59- // the group while the animation was still running
60- if ( ! isCollapsed ) {
61- fixUpHeight ( scope , element , 'auto' ) ;
62- element . addClass ( 'in' ) ;
63- }
64- } ) ;
54+ var targetElHeight = element [ 0 ] . scrollHeight ;
55+ if ( targetElHeight ) {
56+ doTransition ( { height : targetElHeight + 'px' } ) . then ( expandDone ) ;
57+ } else {
58+ expandDone ( ) ;
59+ }
6560 }
66- isCollapsed = false ;
6761 } ;
62+
63+ function expandDone ( ) {
64+ if ( ! isCollapsed ) {
65+ fixUpHeight ( scope , element , 'auto' ) ;
66+ element . addClass ( 'in' ) ;
67+ }
68+ }
6869
6970 var collapse = function ( ) {
7071 isCollapsed = true ;
You can’t perform that action at this time.
0 commit comments