Skip to content

Commit

Permalink
Don't render checkMark (tickIcon) if showTick is false or the select …
Browse files Browse the repository at this point in the history
…is not multiple (#1425, #1426). Mild performance boost.
  • Loading branch information
caseyjhol committed Oct 15, 2018
1 parent 92f643f commit b8fadf6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,11 +941,15 @@
li: document.createElement('li'),
whitespace: document.createTextNode("\u00A0")
},
checkMark = elementTemplates.span.cloneNode(false),
checkMark,
fragment = document.createDocumentFragment();

checkMark.className = that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark';
elementTemplates.a.appendChild(checkMark);
if (that.options.showTick || that.multiple) {
checkMark = elementTemplates.span.cloneNode(false);
checkMark.className = that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark';
elementTemplates.a.appendChild(checkMark);
}

elementTemplates.a.setAttribute('role', 'option');

elementTemplates.subtext.className = 'text-muted';
Expand Down

0 comments on commit b8fadf6

Please sign in to comment.