Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every 'refresh' appends a new span.check-mark #2232

Closed
lcampanari opened this issue Mar 15, 2019 · 2 comments
Closed

Every 'refresh' appends a new span.check-mark #2232

lcampanari opened this issue Mar 15, 2019 · 2 comments

Comments

@lcampanari
Copy link

lcampanari commented Mar 15, 2019

Hello! The method 'refresh' appends a new span.check-mark to every li.dropdown-menu > a when using the attribute multiple.

Steps to reproduce:

  1. Set up a select using the multiple attribute;
  2. Initialize bootstrap-select;
  3. Count .bootstrap-select li:first-child > a > .check-mark
  4. Refresh bootstrap-select;
  5. Repeat 3.

Reduced test case: https://codepen.io/campanari/pen/OqvrRv?editors=1011

For now I modified the function Selectpicker.prototype.createLi as follows:


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

Would this solve this issue without causing any other problems?

Thanks!

@caseyjhol
Copy link
Member

Good catch. That fix won't cause any issues. I'll work on something more robust and make it available in the next release.

@caseyjhol
Copy link
Member

Released in v1.13.9!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants