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

removeClass() with empty arguments does not remove all classes #2

Open
gmcnaughton opened this issue Sep 25, 2015 · 0 comments · May be fixed by #3
Open

removeClass() with empty arguments does not remove all classes #2

gmcnaughton opened this issue Sep 25, 2015 · 0 comments · May be fixed by #3

Comments

@gmcnaughton
Copy link

Per the jQuery docs, calling removeClass() with no arguments should remove all classes:

If a class name is included as a parameter, then only that class will be removed from the set of matched elements. If no class names are specified in the parameter, all classes will be removed.

However with the regexp monkey-patch in place, this gets broken:

$('body').removeClass(); // doesn't remove anything!

Changing line 19 from call to apply fixes the zero-argument case:

removeClass.apply(this, arguments);
gmcnaughton pushed a commit to gmcnaughton/jquery-regexp-classes that referenced this issue Sep 25, 2015
…ll classes).

jQuery's behavior changed somewhere between 1.4.4 and 1.11.3; the 'empty' test
case works against 1.4.4 but not 1.11.3 or 2.1.4.  Changing the fallback case
to pass along the original arguments verbatim fixes the issue.
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

Successfully merging a pull request may close this issue.

1 participant