Skip to content

Commit 92e194c

Browse files
committed
Merge pull request meltingice#50 from michaelperrin/fix/ie8-compatibility
Fix IE7 and IE8 compatibility
2 parents 3d27028 + fcbb3b4 commit 92e194c

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

lib/ajax-chosen.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ajax-chosen.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ajax-chosen.coffee

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,14 @@ do ($ = jQuery) ->
9393
# value => text pairs to inject as <option> elements.
9494
items = callback data
9595

96+
97+
nbItems = 0
98+
9699
# Iterate through the given data and inject the <option> elements into
97100
# the DOM if it doesn't exist in the selector already
98101
$.each items, (i, element) ->
102+
nbItems++
103+
99104
if element.group
100105
group = select.find("optgroup[label='#{element.text}']")
101106
group = $("<optgroup />") unless group.size()
@@ -126,8 +131,8 @@ do ($ = jQuery) ->
126131
.attr('value', value)
127132
.html(text)
128133
.appendTo(select)
129-
130-
if Object.keys(items).length
134+
135+
if nbItems
131136
# Tell chosen that the contents of the <select> input have been updated
132137
# This makes chosen update its internal list of the input data.
133138
select.trigger("liszt:updated")

0 commit comments

Comments
 (0)