assets/js/romo/select.js in romo-0.15.7 vs assets/js/romo/select.js in romo-0.15.8

- old
+ new

@@ -5,10 +5,13 @@ } var RomoSelect = function(element) { this.elem = $(element); + this.defaultCaretClass = undefined; + this.defaultCaretWidthPx = 0; + this.doInit(); this.doBindSelectDropdown(); this.doRefreshUI(); if (this.elem.attr('id') !== undefined) { @@ -142,10 +145,17 @@ var caretClass = this.elem.data('romo-select-caret') || this.defaultCaretClass; if (caretClass !== undefined && caretClass !== 'none') { var caret = $('<i class="romo-select-caret '+caretClass+'"></i>'); caret.css({'line-height': romoSelectDropdownElem.css('line-height')}); caret.on('click', $.proxy(this.onCaretClick, this)); - romoSelectDropdownElem.css({'padding-right': '22px'}); + + var caretWidthPx = this.elem.data('romo-select-caret-width-px') || this.defaultCaretWidthPx; + // left-side spacing + // + caret width + // - 1 px select styling optical illusion + // + right-side spacing + var caretPaddingPx = 4 + caretWidthPx - 1 + 4; + romoSelectDropdownElem.css({'padding-right': caretPaddingPx + 'px'}); romoSelectDropdownElem.append(caret); } return romoSelectDropdownElem; }