Closed cerebrl closed 11 years ago
You can chain add, remove, toggle, selectors, etc..
I'm not sure I follow chaining off methods such as hasClass.
hasClass should check the set to see that each element has that class and spits back true/false. We could return the set which would test for true on its own and allow chaining. If we chain off of it and it fails the hasClass test, it would error trying to call our addClass method on false. I'm not sure if returning an empty set would prevent that or not, or even show up as false.
Ah, sorry. I didn't catch the return this;
in the each function. Sorry. Sure, I agree about the hasClass()
. I just wrote down a quick example and didn't think too much about it. Excellent and closed :)
I think it would be beneficial for us to allow chaining of these methods. E.g.:
So, we just need to return the original object back after each successful (truthy) method execution.