Skip to content
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

Case insensitive :contains? #33

Closed
ganeshv opened this issue Oct 20, 2015 · 6 comments
Closed

Case insensitive :contains? #33

ganeshv opened this issue Oct 20, 2015 · 6 comments

Comments

@ganeshv
Copy link
Contributor

ganeshv commented Oct 20, 2015

Is there a way to do a case insensitive :contains? If not, would :icontains be an acceptable enhancement? I'm willing to do the coding.

@fb55
Copy link
Owner

fb55 commented Oct 20, 2015

Having an i after the searched string might be a nice addition: Eg. :contains("AnY WaY You wAnt To Spell" i). This is already implemented for attributes, but would require changes to css-what.

@ganeshv
Copy link
Contributor Author

ganeshv commented Oct 22, 2015

The possible issue with that syntax is

:contains(anything i)
:contains("anything" i)
:contains("anything i")

would have different semantics, which is not immediately clear at first glance. If :contains had historically forced the use of quotes, or had a different form (e.g. :contains=) it would be a simpler choice.

IMHO icontains is sort of familiar - Django uses it, and there is even a JQuery plugin to supplement its :contains selector called jquery.icontains

@fb55
Copy link
Owner

fb55 commented Oct 24, 2015

I would only do a case-insensitive search for the second of your examples, but I see your point. The Django example isn't exactly for CSS selectors, but I would be fine with it. As always: Pull requests welcome :)

@ganeshv
Copy link
Contributor Author

ganeshv commented Oct 27, 2015

Hi @fb55, the code was pretty easy, but I could do with some guidance on adding tests. I assume you've copied tests from sizzle and qwery and so on. Which set should I insert the :icontains tests?

@fb55
Copy link
Owner

fb55 commented Oct 28, 2015

I would create a new file in the test directory (perhaps icontains.js), then use the format of attributes.js, which already contains the case-insensitive test cases for attributes :).

@fb55
Copy link
Owner

fb55 commented Jan 20, 2018

Fixed in #34

@fb55 fb55 closed this as completed Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants