-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Toggle class #47
Toggle class #47
Conversation
…multiple classes for checking/toggling
…or non-string arguments
It would be interesting to know what's the status with this. It's a tad confusing to have toggleClass in the docs, but not actually in the codebase. Something I can do to help? |
Seems this method was copied/converted in a large merge with another library in #66 ... Not sure if that was released yet... The |
Ah, thanks @simeydotme . So I would suggest closing this, and discuss how to keep releases and docs in sync. |
Both of these fixes were implemented in different ways as of version 1.1.0. Thanks! |
@shshaw ... did you implement my
It doesn't handle multiple classes, just crashes. I think it should make sure all classes are present as was the case with my PR... and is currently the case where I know that actually my PR was never really reviewed/accepted by @kenwheeler , and so I'm willing to accept some change... however I really think that the failing multiple class checking is a bug? |
It was my own implementation of jQuery doesn't document having the ability to check for multiple in their |
Thanks for getting back, @shshaw 😀
so it seems to make sense that:
imagine something like:
having it return true for just one of the classes would be strange. |
I wonder if it might be best to have these as separate methods. |
well that's a logical step, but then it seems like we're just shortening the user's work for:
or
So i'd say that's not work we need to do. |
It's definitely a shortcut, but so are all of these methods 😄 |
Updated the
hasClass
method and added atoggleClass
method, both now will work on the entire collection and accept multiple classes.hasClass
will returnfalse
if any of the items in the collection do not have the given class(es); - to revert to the original behaviour it's as simple as$("el").first().hasClass("className");
Hope you like it, I htink it's a good improvement on the default functionality and another
1up
on jQuery?Creating in response to #46