jquery / jquery/api.jquery.com

addClass/removeClass/toggleClass: add array as a valid argument

Open
#1,073 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
325
Forks
260
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/jquery/jquery/issues/3532

jQuery 3.3 introduces a new signature to these methods, allowing a single array of strings to be passed as the first/only argument.

Note: .removeClass( [] ) will not remove all classes. It is instead equivalent to .removeClass( "" ). Passing no arguments (e.g. .removeClass()) will remove all classes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the API documentation for addClass, removeClass, and toggleClass and compare the current signatures with the jQuery 3.3 change described in the issue. Document that a single array of strings is accepted, including the stated behavior of removeClass([]), and verify that the notes accurately distinguish it from calling removeClass() without arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
jquery
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.