Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,16 @@
if (doneButton) menu.appendChild(doneButton);
newElement.appendChild(menu);

var newElementAnchor = $('a', $(li));
// Get 'visible' css items to restore after calculation is done
var newElementAnchorDisplay = newElementAnchor.css('display');
var newElementAnchorVisibility = newElementAnchor.css('visibility');
newElementAnchor.show(); // always make sure first item is shown, otherwise offsetHeight = 0
if (newElementAnchor.text() === '') {
// If blank, set text to non-breaking space otherwise offsetHeight = 8 (or some portion of full height)
newElementAnchor.text = ' ';
}

document.body.appendChild(newElement);

var liHeight = li.offsetHeight,
Expand Down Expand Up @@ -2170,6 +2180,9 @@
this.sizeInfo.scrollBarWidth = scrollBarWidth;
this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight;

if (newElementAnchorDisplay !== undefined && newElementAnchorDisplay !== '') newElementAnchor.css('display', newElementAnchorDisplay);
if (newElementAnchorVisibility !== undefined && newElementAnchorVisibility !== '') newElementAnchor.css('visibility', newElementAnchorVisibility);

this.setPositionData();
},

Expand Down