Refactor createLi
; add two new features with tests
#48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To start off, I really like your plugin. After looking through 2 or 3 different select dropdown plugins yours is by far my favorite.
I wanted to create a dropdown similar to YouTube's "Date Range" dropdown. It does two things that greatly improve the way the options are listed.
I don't know if it's something you want or not, but I added the Jasmine testing framework to hopefully prevent breaking existing functionality. If you don't like Jasmine, or using the jasmine-gem to run server, you can just grab the changes I made in
bootstrap-select.js
How to use my changes
You can change the option's text by adding a
data-option-text
attribute. This option only applies to the dropdown menu itself. It doesn't modify the the text added to the button.To add a separator you need to set
data-separator
totrue
. The value and text within then<option>
tag is omitted.To style the separator I just added this to my code.