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

Searching from beginning with case sensitivity off populates incorrect suggestions #12

Closed
Kataract opened this Issue Jan 3, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@Kataract
Copy link

Kataract commented Jan 3, 2018

I used the example code from the README, and added data-combobox-case-sensitive="no" and data-combobox-search-option="beginning":

<input type="text" name="mysuper_field" id="id_mysuper_field" class="js-combobox" list="beers" data-combobox-prefix-class="combobox" data-combobox-case-sensitive="no" data-combobox-search-option="beginning"/>
  <datalist id="beers">
    <option value="Meteor">
    <option value="Pils">
    <option value="Kronenbourg">
    <option value="Kronenbourg 2 (for test)">
    <option value="Kronenbourg 3 (for test)">
    <option value="Grimbergen">
  </datalist>

Searching for "b" should provide no suggestions but gives Grimbergen and the 3 Kronenbourg options as suggestions. This works fine with case sensitivity left as the default (on), but for my use case I need to have it off.

It looks like the issue is in the big conditional that splits for containing/beginning - since the containing section evaluates to true (it winds up as false && (false) || (true)), it doesn't matter that the correct end of the conditional found no results.

@nico3333fr nico3333fr self-assigned this Jan 3, 2018

@nico3333fr nico3333fr added the bug label Jan 3, 2018

@nico3333fr

This comment has been minimized.

Copy link
Owner

nico3333fr commented Jan 3, 2018

Hi @Kataract

you're right, I manage to reproduce it, my parenthesis are not well made.

I'm going to fix it in a few minutes...

@nico3333fr

This comment has been minimized.

Copy link
Owner

nico3333fr commented Jan 3, 2018

Hi again @Kataract ,

this is fixed with last commit c4c59e1 (also updated

Thanks a lot for finding and reporting this issue 👍

@nico3333fr nico3333fr closed this Jan 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment