| Index: trunk/phase3/resources/jquery/jquery.makeCollapsible.js |
| — | — | @@ -35,8 +35,8 @@ |
| 36 | 36 | // action must be string with 'expand' or 'collapse' |
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | | - if ( $defaultToggle && !$defaultToggle.jquery ) { |
| 40 | | - // is optional, but if passed must be an instance of jQuery |
| | 39 | + if ( typeof $defaultToggle !== 'undefined' && !($defaultToggle instanceof jQuery) ) { |
| | 40 | + // is optional (may be undefined), but if passed it must be an instance of jQuery and nothing else |
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | var $containers = null; |
| — | — | @@ -49,9 +49,9 @@ |
| 50 | 50 | // Slide doens't work with tables, but fade does as of jQuery 1.1.3 |
| 51 | 51 | // http://stackoverflow.com/questions/467336#920480 |
| 52 | 52 | $containers = $collapsible.find( '>tbody>tr' ); |
| 53 | | - if ( $defaultToggle && $defaultToggle.jquery ) { |
| | 53 | + if ( typeof $defaultToggle !== 'undefined' && ($defaultToggle instanceof jQuery) ) { |
| 54 | 54 | // Exclude tablerow containing togglelink |
| 55 | | - $containers.not( $defaultToggle.parent().parent() ).stop(true, true).fadeOut(); |
| | 55 | + $containers.not( $defaultToggle.closest( 'tr' ) ).stop(true, true).fadeOut(); |
| 56 | 56 | } else { |
| 57 | 57 | if ( instantHide ) { |
| 58 | 58 | $containers.hide(); |
| — | — | @@ -309,7 +309,7 @@ |
| 310 | 310 | // The collapsible element could have multiple togglers |
| 311 | 311 | // To toggle the initial state only click one of them (ie. the first one, eq(0) ) |
| 312 | 312 | // Else it would go like: hide,show,hide,show for each toggle link. |
| 313 | | - toggleElement( $that, 'collapse', null, /* instantHide = */ true ); |
| | 313 | + toggleElement( $that, 'collapse', $toggleLink.eq(0), /* instantHide = */ true ); |
| 314 | 314 | $toggleLink.eq(0).click(); |
| 315 | 315 | } |
| 316 | 316 | } ); |