Closed jitcoder closed 8 years ago
Important Detail: this only seems to happen when a select dropdown is dynamically populated ie. from an ajax request
Hi, the code you've mentioned does breaks the image rendering for the current plugin setup, can you provide a working example of the problem?
I have the same issue here and added a
.group-result img {
display: none;
}
To get rid of image display in optgroup
with the following HTML
<select class="my-select">
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">First</option>
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">Second</option>
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">Third</option>
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">Fourth</option>
<optgroup label="pop">
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">First</option>
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">Second</option>
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">Third</option>
<option data-img-src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-128.png">Fourth</option>
</optgroup>
</select>
Why do you close ?
Symptoms: Optgroups get the image of the previous element with a data-img-src in them assigned to them for multi-select dropdowns.
because of the "mismatch-count" in the proceeding for-loop that loops through li's any options elements existing after some opt groups would not get their icons rendered.
Steps to reproduce:
Multi-select dropdown, with 2 opt-groups. 1st opt-group has 1 item with image#1 2nd opt-group contains a disabled option with image#2
Result -> noicon | optgroup icon | option icon | optgroup <-- error is here. there should be no icon here. icon | option
Steps to reproduce 2nd issue due to same block of code:
Multi-select dropdown with 2 opt-groups. 1st opt-group has 0 items 2nd opt-group contains a disabled option with image#2
Result-> noicon | optgroup noicon | option <-- error is here. there should be an icon here.
changing
to
fixed the issue. (line numbers 152 & 153)