Skip to content

Commit 7999602

Browse files
SteveTheTechieHarris
authored andcommitted
Fix trailing whitespace issue with newlines.
Prevents browsers from converting trailing newlines to spaces when using the selectedList option and the native select lacks closing option tags. Without this change it looks like extra spaces are added.
1 parent 1a7a53d commit 7999602

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/jquery.multiselect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@
549549
value = selectedText.call(self, numChecked, inputCount, $checked.get());
550550
}
551551
else if (/\d/.test(selectedList) && selectedList > 0 && numChecked <= selectedList) {
552-
value = $checked.map(function() { return $(this).next().text() }).get().join(options.selectedListSeparator);
552+
value = $checked.map(function() { return $(this).next().text().replace(/\n$/, '') })
553+
.get().join(options.selectedListSeparator);
553554
}
554555
else {
555556
value = selectedText.replace('#', numChecked).replace('#', inputCount);

0 commit comments

Comments
 (0)