-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Search Optgroups #1343
Search Optgroups #1343
Conversation
…sen into better_text_escaping Conflicts: chosen/chosen.jquery.js chosen/chosen.jquery.min.js chosen/chosen.proto.js chosen/chosen.proto.min.js coffee/lib/abstract-chosen.coffee
option.search_match = false | ||
else | ||
|
||
option.group_match = false if option.group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
group_match
tracks whether or not a child option matches (group headers get displayed when a child option matches)
@@ -88,6 +89,10 @@ class AbstractChosen | |||
|
|||
"""<li id="#{option.dom_id}" class="#{classes.join(' ')}"#{style}>#{option.search_text}</li>""" | |||
|
|||
result_add_group: (group) -> | |||
group.dom_id = @container_id + "_g_" + group.array_index | |||
"""<li id="#{group.dom_id}" class="group-result">#{group.search_text}</li>""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really liking the block string syntax here. Very readable :)
This fixes an issue where group search text doesn't get reset properly and simplifies the match functionality.
@kenearley Take a look at 1b7cd20 and re-test if you don't mind. That fixes the issue you described above and simplifies the code in a way that makes me happy. I'll merge this as soon as you re-+1. |
@pfiller Looks good to me. again. |
Hey chaps, how about adding |
@suspiciousfellow Thanks for the heads-up! I opened #2752 to track that. Feel free to open a PR if you'd like to take a swing at it! |
@kenearley @stof @koenpunt
Exactly what it says on the label: this adds optgroups to the search mechanism. When a group matches, all of its child options are shown regardless of their match status.
This also brings in escaping for optgroup labels. There's a long outstanding XSS vulnerability that needs closing.
Fixes #298
Addresses part of #124