Custom selector and fix for change event #18
Merged
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.
859a7ae fixes your todo item at the bottom. It shouldn't affect speed since nothing in the loop changed.
01f76c5 adds a custom selector option, similar to what was suggested in #6.
I've modified the code for clarity and tested it on a list of about 2,100 items. Compared to the original version, there appears to be no noticeable difference when a selector is not specified (i.e. the default, backwards-compatible behavior). As expected, however, there is a nominal performance hit when using a selector. (I've noted this in the readme for prospective users.)
I believe this will be useful for a lot of people. My use case is something like this:
By default, the filter will compare against
Badge TextDescription
, which is undesirable. But when.description
is used as a selector, the plugin compares only againstDescription
, which is the desired behavior.7ad6fcd removes the use of
addback()
, which was benign but unnecessary and would have made the plugin incompatible with jQuery < 1.8.