-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
pseudos: implement :icontains, case-insensitive version of :contains #34
Conversation
icontains: function(next, text){ | ||
return function icontains(elem){ | ||
return next(elem) && | ||
getText(elem).toLowerCase().indexOf(text.toLowerCase()) >= 0; |
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.
text.toLowerCase()
can be called while compiling (can be moved out of the returned function).
One small improvement and this is good to go :) |
03b5dfb
to
459714e
Compare
Updates: moved the text.toLowerCase() outside and fixed up tabs, rebased and squished it into the same commit. |
@@ -0,0 +1,87 @@ | |||
var CSSselect = require("../"), | |||
makeDom = require("htmlparser2").parseDOM, | |||
falseFunc = require("boolbase").falseFunc, |
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.
This isn't used.
Whee, sorry, failed to check this again. jshint produced two errors (see comments), do you want to fix them? |
OK, fixed the above two, rebased to master, squashed into single commit. |
@ganeshv One of your test cases is still failing: |
For that test to pass, it needs css-what with my other pull request which you have already merged. Manually copying index.js from css-what/master to node_modules/... does get the test to pass. Let me know how to proceed. (Sorry for the back and forth, I'm kinda new to the node.js ecosystem. Thanks for your patience.) |
Okay, my bad. I've published a new |
pseudos: implement :icontains, case-insensitive version of :contains
pseudos: implement :icontains, case-insensitive version of :contains
As discussed in issue 33, with tests.
One of the tests fails and needs a corresponding fix in css-what to strip the quotes of
icontains
data. I have opened a separate PR for that issue.