Sha256: 411e9170e6b0f104b3f45adcf42b301059bbc8e3c5c78412c9cd8a1476c17b6c

Contents?: true

Size: 1.39 KB

Versions: 72

Compression:

Stored size: 1.39 KB

Contents

define([
  'jquery',
  './utils'
], function ($, CompatUtils) {
  // No-op CSS adapter that discards all classes by default
  function _dropdownAdapter (clazz) {
    return null;
  }

  function DropdownCSS () { }

  DropdownCSS.prototype.render = function (decorated) {
    var $dropdown = decorated.call(this);

    var dropdownCssClass = this.options.get('dropdownCssClass') || '';

    if ($.isFunction(dropdownCssClass)) {
      dropdownCssClass = dropdownCssClass(this.$element);
    }

    var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
    dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;

    if (dropdownCssClass.indexOf(':all:') !== -1) {
      dropdownCssClass = dropdownCssClass.replace(':all:', '');

      var _cssAdapter = dropdownCssAdapter;

      dropdownCssAdapter = function (clazz) {
        var adapted = _cssAdapter(clazz);

        if (adapted != null) {
          // Append the old one along with the adapted one
          return adapted + ' ' + clazz;
        }

        return clazz;
      };
    }

    var dropdownCss = this.options.get('dropdownCss') || {};

    if ($.isFunction(dropdownCss)) {
      dropdownCss = dropdownCss(this.$element);
    }

    CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);

    $dropdown.css(dropdownCss);
    $dropdown.addClass(dropdownCssClass);

    return $dropdown;
  };

  return DropdownCSS;
});

Version data entries

72 entries across 72 versions & 6 rubygems

Version Path
card-mod-bootstrap-0.14.2 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.14.1 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.14.0 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.13.4 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.13.3 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.13.2 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.13.1 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.13.0 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.7 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.12.0 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.6 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.5 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.4 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.3 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.2 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.1 vendor/select2/src/js/select2/compat/dropdownCss.js
card-mod-bootstrap-0.11.0 vendor/select2/src/js/select2/compat/dropdownCss.js
card-1.100.0 mod/bootstrap/vendor/select2/src/js/select2/compat/dropdownCss.js
card-1.99.6 mod/bootstrap/vendor/select2/src/js/select2/compat/dropdownCss.js
card-1.99.5 mod/bootstrap/vendor/select2/src/js/select2/compat/dropdownCss.js