diff --git a/Gruntfile.js b/Gruntfile.js index 4176a69..8551313 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,7 +16,7 @@ module.exports = function(grunt) { }, concat: { dist: { - src: ['src/javascripts/jquery.selectBoxIt.core.js', 'src/javascripts/jquery.selectBoxIt.add.js', 'src/javascripts/jquery.selectBoxIt.ariaAccessibility.js', 'src/javascripts/jquery.selectBoxIt.copyAttributes.js', 'src/javascripts/jquery.selectBoxIt.destroy.js', 'src/javascripts/jquery.selectBoxIt.disable.js', 'src/javascripts/jquery.selectBoxIt.dynamicPositioning.js', 'src/javascripts/jquery.selectBoxIt.enable.js', 'src/javascripts/jquery.selectBoxIt.keyboardNavigation.js', 'src/javascripts/jquery.selectBoxIt.keyboardSearch.js', 'src/javascripts/jquery.selectBoxIt.mobile.js', 'src/javascripts/jquery.selectBoxIt.remove.js', 'src/javascripts/jquery.selectBoxIt.selectOption.js', 'src/javascripts/jquery.selectBoxIt.setOption.js', 'src/javascripts/jquery.selectBoxIt.setOptions.js', 'src/javascripts/jquery.selectBoxIt.wait.js', 'src/javascripts/jquery.selectBoxIt.endClosure.js'], + src: ['src/javascripts/modules/jquery.selectBoxIt.core.js', 'src/javascripts/modules/jquery.selectBoxIt.add.js', 'src/javascripts/modules/jquery.selectBoxIt.ariaAccessibility.js', 'src/javascripts/modules/jquery.selectBoxIt.copyAttributes.js', 'src/javascripts/modules/jquery.selectBoxIt.destroy.js', 'src/javascripts/modules/jquery.selectBoxIt.disable.js', 'src/javascripts/modules/jquery.selectBoxIt.dynamicPositioning.js', 'src/javascripts/modules/jquery.selectBoxIt.enable.js', 'src/javascripts/modules/jquery.selectBoxIt.keyboardNavigation.js', 'src/javascripts/modules/jquery.selectBoxIt.keyboardSearch.js', 'src/javascripts/modules/jquery.selectBoxIt.mobile.js', 'src/javascripts/modules/jquery.selectBoxIt.remove.js', 'src/javascripts/modules/jquery.selectBoxIt.selectOption.js', 'src/javascripts/modules/jquery.selectBoxIt.setOption.js', 'src/javascripts/modules/jquery.selectBoxIt.setOptions.js', 'src/javascripts/modules/jquery.selectBoxIt.wait.js', 'src/javascripts/modules/jquery.selectBoxIt.endClosure.js'], dest: 'src/javascripts/jquery.selectBoxIt.js' } }, diff --git a/README.md b/README.md index 93d71dd..3267291 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,17 @@ If you find that you need a feature that SelectBoxIt does not currently support, ##Change Log +`3.8.0` - October 4, 2013 + +**Bug Fixes** +- Fixed mobile hidden select box with bug: [#209](https://github.com/gfranko/jquery.selectBoxIt.js/issues/209) +- Prevent disabled Selects from being clickable on iOS devices: [#203](https://github.com/gfranko/jquery.selectBoxIt.js/issues/203) +- Fixed defaultText mobile bug: [#205](https://github.com/gfranko/jquery.selectBoxIt.js/issues/205) + +**Improvements** +- Improved performance by not removing option icons [#207](https://github.com/gfranko/jquery.selectBoxIt.js/issues/207) +- Allow passing in a custom theme object [#204](https://github.com/gfranko/jquery.selectBoxIt.js/issues/204) + `3.7.0` - August 13, 2013 **Bug Fixes** diff --git a/index.html b/index.html index 72907cb..eddfb46 100644 --- a/index.html +++ b/index.html @@ -357,7 +357,7 @@ - + @@ -376,10 +376,7 @@ $('select').selectBoxIt({ defaultText: 'Testing', - autoWidth: false, - theme: { - 'list': 'greg-list' - } + autoWidth: false }); $('form').removeClass('hidden'); diff --git a/src/javascripts/jquery.selectBoxIt.js b/src/javascripts/jquery.selectBoxIt.js index d89be93..93a0c4a 100644 --- a/src/javascripts/jquery.selectBoxIt.js +++ b/src/javascripts/jquery.selectBoxIt.js @@ -492,8 +492,12 @@ currentDataText, + currentDataSearch, + currentText, + currentOption, + parent; // Checks the `showFirstOption` plugin option to determine if the first dropdown list option should be shown in the options list. @@ -511,27 +515,29 @@ // into new list item elements of the new dropdown list self.selectItems.each(function(index) { + currentOption = $(this); + optgroupClass = ""; optgroupElement = ""; - dataDisabled = $(this).prop("disabled"); + dataDisabled = currentOption.prop("disabled"); - iconClass = $(this).attr("data-icon") || ""; + iconClass = currentOption.attr("data-icon") || ""; - iconUrl = $(this).attr("data-iconurl") || ""; + iconUrl = currentOption.attr("data-iconurl") || ""; iconUrlClass = iconUrl ? "selectboxit-option-icon-url": ""; iconUrlStyle = iconUrl ? 'style="background-image:url(\'' + iconUrl + '\');"': ""; - currentDataSelectedText = $(this).attr("data-selectedtext"); + currentDataSelectedText = currentOption.attr("data-selectedtext"); - currentDataText = $(this).attr("data-text"); + currentDataText = currentOption.attr("data-text"); - currentText = currentDataText ? currentDataText: $(this).text(); + currentText = currentDataText ? currentDataText: currentOption.text(); - parent = $(this).parent(); + parent = currentOption.parent(); // If the current option being traversed is within an optgroup @@ -539,7 +545,7 @@ optgroupClass = "selectboxit-optgroup-option"; - if($(this).index() === 0) { + if(currentOption.index() === 0) { optgroupElement = '' + parent.first().attr("label") + ''; @@ -550,9 +556,11 @@ // Uses string concatenation for speed (applies HTML attribute encoding) currentItem += optgroupElement + '
  • ' + (self.options["html"] ? currentText: self.htmlEscape(currentText)) + '
  • '; + currentDataSearch = currentOption.attr("data-search"); + // Stores all of the original select box options text inside of an array // (Used later in the `searchAlgorithm` method) - self.textArray[index] = dataDisabled ? "": currentText; + self.textArray[index] = dataDisabled ? "": currentDataSearch ? currentDataSearch: currentText; // Checks the original select box option for the `selected` attribute if (this.selected) { @@ -2767,7 +2775,7 @@ selectBoxIt._destroySelectBoxIt = function() { // Resets the regular expression with the new value of `self.currentText` alphaNumeric = new RegExp(currentText, "gi"); - // Searches based on the first letter of the dropdown list options text if the currentText < 2 characters + // Searches based on the first letter of the dropdown list options text if the currentText < 3 characters if (currentText.length < 3) { alphaNumeric = new RegExp(currentText.charAt(0), "gi"); diff --git a/src/javascripts/jquery.selectBoxIt.min.js b/src/javascripts/jquery.selectBoxIt.min.js index 6e74da7..3a80cf2 100755 --- a/src/javascripts/jquery.selectBoxIt.min.js +++ b/src/javascripts/jquery.selectBoxIt.min.js @@ -1,4 +1,4 @@ -/*! jquery.selectBoxIt - v3.8.0 - 2013-10-03 +/*! jquery.selectBoxIt - v3.8.0 - 2013-10-04 * http://www.selectboxit.com * Copyright (c) 2013 Greg Franko; Licensed MIT*/ -!function(a){"use strict";a(window.jQuery,window,document)}(function(a,b,c,d){"use strict";a.widget("selectBox.selectBoxIt",{VERSION:"3.8.0",options:{showEffect:"none",showEffectOptions:{},showEffectSpeed:"medium",hideEffect:"none",hideEffectOptions:{},hideEffectSpeed:"medium",showFirstOption:!0,defaultText:"",defaultIcon:"",downArrowIcon:"",theme:"default",keydownOpen:!0,isMobile:function(){var a=navigator.userAgent||navigator.vendor||b.opera;return/iPhone|iPod|iPad|Silk|Android|BlackBerry|Opera Mini|IEMobile/.test(a)},"native":!1,aggressiveChange:!1,selectWhenHidden:!0,viewport:a(b),similarSearch:!1,copyAttributes:["title","rel"],copyClasses:"button",nativeMousedown:!1,customShowHideEvent:!1,autoWidth:!0,html:!0,populate:"",dynamicPositioning:!0,hideCurrent:!1},getThemes:function(){var b=this,c=a(b.element).attr("data-theme")||"c";return{bootstrap:{focus:"active",hover:"",enabled:"enabled",disabled:"disabled",arrow:"caret",button:"btn",list:"dropdown-menu",container:"bootstrap",open:"open"},jqueryui:{focus:"ui-state-focus",hover:"ui-state-hover",enabled:"ui-state-enabled",disabled:"ui-state-disabled",arrow:"ui-icon ui-icon-triangle-1-s",button:"ui-widget ui-state-default",list:"ui-widget ui-widget-content",container:"jqueryui",open:"selectboxit-open"},jquerymobile:{focus:"ui-btn-down-"+c,hover:"ui-btn-hover-"+c,enabled:"ui-enabled",disabled:"ui-disabled",arrow:"ui-icon ui-icon-arrow-d ui-icon-shadow",button:"ui-btn ui-btn-icon-right ui-btn-corner-all ui-shadow ui-btn-up-"+c,list:"ui-btn ui-btn-icon-right ui-btn-corner-all ui-shadow ui-btn-up-"+c,container:"jquerymobile",open:"selectboxit-open"},"default":{focus:"selectboxit-focus",hover:"selectboxit-hover",enabled:"selectboxit-enabled",disabled:"selectboxit-disabled",arrow:"selectboxit-default-arrow",button:"selectboxit-btn",list:"selectboxit-list",container:"selectboxit-container",open:"selectboxit-open"}}},isDeferred:function(b){return a.isPlainObject(b)&&b.promise&&b.done},_create:function(b){var d=this,e=d.options.populate,f=d.options.theme;if(d.element.is("select"))return d.widgetProto=a.Widget.prototype,d.originalElem=d.element[0],d.selectBox=d.element,d.options.populate&&d.add&&!b&&d.add(e),d.selectItems=d.element.find("option"),d.firstSelectItem=d.selectItems.slice(0,1),d.documentHeight=a(c).height(),d.theme=a.isPlainObject(f)?a.extend({},d.getThemes()["default"],f):d.getThemes()[f]?d.getThemes()[f]:d.getThemes()["default"],d.currentFocus=0,d.blur=!0,d.textArray=[],d.currentIndex=0,d.currentText="",d.flipped=!1,b||(d.selectBoxStyles=d.selectBox.attr("style")),d._createDropdownButton()._createUnorderedList()._copyAttributes()._replaceSelectBox()._addClasses(d.theme)._eventHandlers(),d.originalElem.disabled&&d.disable&&d.disable(),d._ariaAccessibility&&d._ariaAccessibility(),d.isMobile=d.options.isMobile(),d._mobile&&d._mobile(),d.options["native"]&&this._applyNativeSelect(),d.triggerEvent("create"),d},_createDropdownButton:function(){var b=this,c=b.originalElemId=b.originalElem.id||"",d=b.originalElemValue=b.originalElem.value||"",e=b.originalElemName=b.originalElem.name||"",f=b.options.copyClasses,g=b.selectBox.attr("class")||"";return b.dropdownText=a("",{id:c&&c+"SelectBoxItText","class":"selectboxit-text",unselectable:"on",text:b.firstSelectItem.text()}).attr("data-val",d),b.dropdownImageContainer=a("",{"class":"selectboxit-option-icon-container"}),b.dropdownImage=a("",{id:c&&c+"SelectBoxItDefaultIcon","class":"selectboxit-default-icon",unselectable:"on"}),b.dropdown=a("",{id:c&&c+"SelectBoxIt","class":"selectboxit "+("button"===f?g:"")+" "+(b.selectBox.prop("disabled")?b.theme.disabled:b.theme.enabled),name:e,tabindex:b.selectBox.attr("tabindex")||"0",unselectable:"on"}).append(b.dropdownImageContainer.append(b.dropdownImage)).append(b.dropdownText),b.dropdownContainer=a("",{id:c&&c+"SelectBoxItContainer","class":b.theme.container+" "+("container"===f?g:"")}).append(b.dropdown),b},_createUnorderedList:function(){var b,c,d,e,f,g,h,i,j,k,l,m=this,n="",o=m.originalElemId||"",p=a("
      ",{id:o&&o+"SelectBoxItOptions","class":"selectboxit-options",tabindex:-1});if(m.options.showFirstOption||(m.selectItems.first().attr("disabled","disabled"),m.selectItems=m.selectBox.find("option").slice(1)),m.selectItems.each(function(o){c="",d="",b=a(this).prop("disabled"),e=a(this).attr("data-icon")||"",f=a(this).attr("data-iconurl")||"",g=f?"selectboxit-option-icon-url":"",h=f?"style=\"background-image:url('"+f+"');\"":"",i=a(this).attr("data-selectedtext"),j=a(this).attr("data-text"),k=j?j:a(this).text(),l=a(this).parent(),l.is("optgroup")&&(c="selectboxit-optgroup-option",0===a(this).index()&&(d=''+l.first().attr("label")+"")),n+=d+'
    • "+(m.options.html?k:m.htmlEscape(k))+"
    • ",m.textArray[o]=b?"":k,this.selected&&(m._setText(m.dropdownText,i||k),m.currentFocus=o)}),m.options.defaultText||m.selectBox.attr("data-text")){var q=m.options.defaultText||m.selectBox.attr("data-text");m._setText(m.dropdownText,q),m.options.defaultText=q}return p.append(n),m.list=p,m.dropdownContainer.append(m.list),m.listItems=m.list.children("li"),m.listAnchors=m.list.find("a"),m.listItems.first().addClass("selectboxit-option-first"),m.listItems.last().addClass("selectboxit-option-last"),m.list.find("li[data-disabled='true']").not(".optgroupHeader").addClass(m.theme.disabled),m.dropdownImage.addClass(m.selectBox.attr("data-icon")||m.options.defaultIcon||m.listItems.eq(m.currentFocus).find("i").attr("class")),m.dropdownImage.attr("style",m.listItems.eq(m.currentFocus).find("i").attr("style")),m},_replaceSelectBox:function(){var b,c,e,f=this,g=f.originalElem.id||"",h=f.selectBox.attr("data-size"),i=f.listSize=h===d?"auto":"0"===h?"auto":+h;return f.selectBox.css("display","none").after(f.dropdownContainer),f.dropdownContainer.appendTo("body").addClass("selectboxit-rendering"),b=f.dropdown.height(),f.downArrow=a("",{id:g&&g+"SelectBoxItArrow","class":"selectboxit-arrow",unselectable:"on"}),f.downArrowContainer=a("",{id:g&&g+"SelectBoxItArrowContainer","class":"selectboxit-arrow-container",unselectable:"on"}).append(f.downArrow),f.dropdown.append(f.downArrowContainer),f.listItems.removeClass("selectboxit-selected").eq(f.currentFocus).addClass("selectboxit-selected"),c=f.downArrowContainer.outerWidth(!0),e=f.dropdownImage.outerWidth(!0),f.options.autoWidth&&(f.dropdown.css({width:"auto"}).css({width:f.list.outerWidth(!0)+c+e}),f.list.css({"min-width":f.dropdown.width()})),f.dropdownText.css({"max-width":f.dropdownContainer.outerWidth(!0)-(c+e)}),f.selectBox.after(f.dropdownContainer),f.dropdownContainer.removeClass("selectboxit-rendering"),"number"===a.type(i)&&(f.maxHeight=f.listAnchors.outerHeight(!0)*i),f},_scrollToView:function(a){var b=this,c=b.listItems.eq(b.currentFocus),d=b.list.scrollTop(),e=c.height(),f=c.position().top,g=Math.abs(f),h=b.list.height();return"search"===a?e>h-f?b.list.scrollTop(d+(f-(h-e))):-1>f&&b.list.scrollTop(f-e):"up"===a?-1>f&&b.list.scrollTop(d-g):"down"===a&&e>h-f&&b.list.scrollTop(d+(g-h+e)),b},_callbackSupport:function(b){var c=this;return a.isFunction(b)&&b.call(c,c.dropdown),c},_setText:function(a,b){var c=this;return c.options.html?a.html(b):a.text(b),c},open:function(a){var b=this,c=b.options.showEffect,d=b.options.showEffectSpeed,e=b.options.showEffectOptions,f=b.options["native"],g=b.isMobile;return!b.listItems.length||b.dropdown.hasClass(b.theme.disabled)?b:(f||g||this.list.is(":visible")||(b.triggerEvent("open"),b._dynamicPositioning&&b.options.dynamicPositioning&&b._dynamicPositioning(),"none"===c?b.list.show():"show"===c||"slideDown"===c||"fadeIn"===c?b.list[c](d):b.list.show(c,e,d),b.list.promise().done(function(){b._scrollToView("search")})),b._callbackSupport(a),b)},close:function(a){var b=this,c=b.options.hideEffect,d=b.options.hideEffectSpeed,e=b.options.hideEffectOptions,f=b.options["native"],g=b.isMobile;return f||g||!b.list.is(":visible")||(b.triggerEvent("close"),"none"===c?b.list.hide():"hide"===c||"slideUp"===c||"fadeOut"===c?b.list[c](d):b.list.hide(c,e,d)),b._callbackSupport(a),b},toggle:function(){var a=this,b=a.list.is(":visible");b?a.close():b||a.open()},_keyMappings:{38:"up",40:"down",13:"enter",8:"backspace",9:"tab",32:"space",27:"esc"},_keydownMethods:function(){var a=this,b=a.list.is(":visible")||!a.options.keydownOpen;return{down:function(){a.moveDown&&b&&a.moveDown()},up:function(){a.moveUp&&b&&a.moveUp()},enter:function(){var b=a.listItems.eq(a.currentFocus);a._update(b),"true"!==b.attr("data-preventclose")&&a.close(),a.triggerEvent("enter")},tab:function(){a.triggerEvent("tab-blur"),a.close()},backspace:function(){a.triggerEvent("backspace")},esc:function(){a.close()}}},_eventHandlers:function(){var b,c,d=this,e=d.options.nativeMousedown,f=d.options.customShowHideEvent,g=d.focusClass,h=d.hoverClass,i=d.openClass;return this.dropdown.on({"click.selectBoxIt":function(){d.dropdown.trigger("focus",!0),d.originalElem.disabled||(d.triggerEvent("click"),e||f||d.toggle())},"mousedown.selectBoxIt":function(){a(this).data("mdown",!0),d.triggerEvent("mousedown"),e&&!f&&d.toggle()},"mouseup.selectBoxIt":function(){d.triggerEvent("mouseup")},"blur.selectBoxIt":function(){d.blur&&(d.triggerEvent("blur"),d.close(),a(this).removeClass(g))},"focus.selectBoxIt":function(b,c){var e=a(this).data("mdown");a(this).removeData("mdown"),e||c||setTimeout(function(){d.triggerEvent("tab-focus")},0),c||(a(this).hasClass(d.theme.disabled)||a(this).addClass(g),d.triggerEvent("focus"))},"keydown.selectBoxIt":function(a){var b=d._keyMappings[a.keyCode],c=d._keydownMethods()[b];c&&(c(),!d.options.keydownOpen||"up"!==b&&"down"!==b||d.open()),c&&"tab"!==b&&a.preventDefault()},"keypress.selectBoxIt":function(a){var b=a.charCode||a.keyCode,c=d._keyMappings[a.charCode||a.keyCode],e=String.fromCharCode(b);d.search&&(!c||c&&"space"===c)&&d.search(e,!0,!0),"space"===c&&a.preventDefault()},"mouseenter.selectBoxIt":function(){d.triggerEvent("mouseenter")},"mouseleave.selectBoxIt":function(){d.triggerEvent("mouseleave")}}),d.list.on({"mouseover.selectBoxIt":function(){d.blur=!1},"mouseout.selectBoxIt":function(){d.blur=!0},"focusin.selectBoxIt":function(){d.dropdown.trigger("focus",!0)}}),d.list.on({"mousedown.selectBoxIt":function(){d._update(a(this)),d.triggerEvent("option-click"),"false"===a(this).attr("data-disabled")&&"true"!==a(this).attr("data-preventclose")&&d.close(),setTimeout(function(){d.dropdown.trigger("focus",!0)},0)},"focusin.selectBoxIt":function(){d.listItems.not(a(this)).removeAttr("data-active"),a(this).attr("data-active","");var b=d.list.is(":hidden");(d.options.searchWhenHidden&&b||d.options.aggressiveChange||b&&d.options.selectWhenHidden)&&d._update(a(this)),a(this).addClass(g)},"mouseup.selectBoxIt":function(){e&&!f&&(d._update(a(this)),d.triggerEvent("option-mouseup"),"false"===a(this).attr("data-disabled")&&"true"!==a(this).attr("data-preventclose")&&d.close())},"mouseenter.selectBoxIt":function(){"false"===a(this).attr("data-disabled")&&(d.listItems.removeAttr("data-active"),a(this).addClass(g).attr("data-active",""),d.listItems.not(a(this)).removeClass(g),a(this).addClass(g),d.currentFocus=+a(this).attr("id"))},"mouseleave.selectBoxIt":function(){"false"===a(this).attr("data-disabled")&&(d.listItems.not(a(this)).removeClass(g).removeAttr("data-active"),a(this).addClass(g),d.currentFocus=+a(this).attr("id"))},"blur.selectBoxIt":function(){a(this).removeClass(g)}},".selectboxit-option"),d.list.on({"click.selectBoxIt":function(a){a.preventDefault()}},"a"),d.selectBox.on({"change.selectBoxIt, internal-change.selectBoxIt":function(a,e){var f,g;e||(f=d.list.find('li[data-val="'+d.originalElem.value+'"]'),f.length&&(d.listItems.eq(d.currentFocus).removeClass(d.focusClass),d.currentFocus=+f.attr("id"))),f=d.listItems.eq(d.currentFocus),g=f.attr("data-selectedtext"),b=f.attr("data-text"),c=b?b:f.find("a").text(),d._setText(d.dropdownText,g||c),d.dropdownText.attr("data-val",d.originalElem.value),f.find("i").attr("class")&&(d.dropdownImage.attr("class",f.find("i").attr("class")).addClass("selectboxit-default-icon"),d.dropdownImage.attr("style",f.find("i").attr("style"))),d.triggerEvent("changed")},"disable.selectBoxIt":function(){d.dropdown.addClass(d.theme.disabled)},"enable.selectBoxIt":function(){d.dropdown.removeClass(d.theme.disabled)},"open.selectBoxIt":function(){var a,b=d.list.find("li[data-val='"+d.dropdownText.attr("data-val")+"']");b.length||(b=d.listItems.not("[data-disabled=true]").first()),d.currentFocus=+b.attr("id"),a=d.listItems.eq(d.currentFocus),d.dropdown.addClass(i).removeClass(h).addClass(g),d.listItems.removeClass(d.selectedClass).removeAttr("data-active").not(a).removeClass(g),a.addClass(d.selectedClass).addClass(g),d.options.hideCurrent&&(d.listItems.show(),a.hide())},"close.selectBoxIt":function(){d.dropdown.removeClass(i)},"blur.selectBoxIt":function(){d.dropdown.removeClass(g)},"mouseenter.selectBoxIt":function(){a(this).hasClass(d.theme.disabled)||d.dropdown.addClass(h)},"mouseleave.selectBoxIt":function(){d.dropdown.removeClass(h)},destroy:function(a){a.preventDefault(),a.stopPropagation()}}),d},_update:function(a){var b,c,d,e=this,f=e.options.defaultText||e.selectBox.attr("data-text"),g=e.listItems.eq(e.currentFocus);"false"===a.attr("data-disabled")&&(b=e.listItems.eq(e.currentFocus).attr("data-selectedtext"),c=g.attr("data-text"),d=c?c:g.text(),(f&&e.options.html?e.dropdownText.html()===f:e.dropdownText.text()===f)&&e.selectBox.val()===a.attr("data-val")?e.triggerEvent("change"):(e.selectBox.val(a.attr("data-val")),e.currentFocus=+a.attr("id"),e.originalElem.value!==e.dropdownText.attr("data-val")&&e.triggerEvent("change")))},_addClasses:function(a){var b=this,c=(b.focusClass=a.focus,b.hoverClass=a.hover,a.button),d=a.list,e=a.arrow,f=a.container;return b.openClass=a.open,b.selectedClass="selectboxit-selected",b.downArrow.addClass(b.selectBox.attr("data-downarrow")||b.options.downArrowIcon||e),b.dropdownContainer.addClass(f),b.dropdown.addClass(c),b.list.addClass(d),b},refresh:function(a,b){var c=this;return c._destroySelectBoxIt()._create(!0),b||c.triggerEvent("refresh"),c._callbackSupport(a),c},htmlEscape:function(a){return String(a).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")},triggerEvent:function(a){var b=this,c=b.options.showFirstOption?b.currentFocus:b.currentFocus-1>=0?b.currentFocus:0;return b.selectBox.trigger(a,{selectbox:b.selectBox,selectboxOption:b.selectItems.eq(c),dropdown:b.dropdown,dropdownOption:b.listItems.eq(b.currentFocus)}),b},_copyAttributes:function(){var a=this;return a._addSelectBoxAttributes&&a._addSelectBoxAttributes(),a},_realOuterWidth:function(a){if(a.is(":visible"))return a.outerWidth(!0);var b,c=a.clone();return c.css({visibility:"hidden",display:"block",position:"absolute"}).appendTo("body"),b=c.outerWidth(!0),c.remove(),b}});var e=a.selectBox.selectBoxIt.prototype;e.add=function(b,c){this._populate(b,function(b){var d,e,f=this,g=a.type(b),h=0,i=[],j=f._isJSON(b),k=j&&f._parseJSON(b);if(b&&("array"===g||j&&k.data&&"array"===a.type(k.data))||"object"===g&&b.data&&"array"===a.type(b.data)){for(f._isJSON(b)&&(b=k),b.data&&(b=b.data),e=b.length;e-1>=h;h+=1)d=b[h],a.isPlainObject(d)?i.push(a("