Make collapsible code more resilient

$.collapsibleTabs.getSettings can return undefined so the code
should take this into account

Bug: T177108
Change-Id: I2630a2ba2884542869748047ab84752543072647
This commit is contained in:
jdlrobson 2020-07-15 18:20:23 -07:00
parent 1ccf9f7fcb
commit 17a07e4c76
1 changed files with 7 additions and 1 deletions

View File

@ -71,7 +71,13 @@ function init() {
$.collapsibleTabs.addData( $collapsible );
settings = $collapsible.data( 'collapsibleTabsSettings' );
}
return settings;
// it's possible for getSettings to return undefined
// if no data attributes have been set
// see T177108#6310908.
// In particular, a gadget may have added a collapsible link to the list:
// e.g.
// $('<li class="collapsible">my link</a>').appendTo( $('#p-cactions ul') )
return settings || {};
},
handleResize: function () {
$.collapsibleTabs.instances.forEach( function ( $el ) {