Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12380 closed feature (wontfix)

array as argument for addClass, removeClass

Reported by: dienase@… Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.8.0
Keywords: 1.9-discuss Cc:
Blocked by: Blocking:

Description

It would be nice if we could just use an array as an argument for addClass and removeClass to allow multiple classes to be created at once.

I know that I can pass multiple classes as a string but that doesn't help me much.

I am using this at the moment:

$(element).addClass(['bla','blubb','wuff'].join(' '));

Thanks for considering! :-)

Change History (8)

comment:1 Changed 11 years ago by Timmy Willison

Component: unfiledmisc
Keywords: 1.9-discuss added
Priority: undecidedlow
Status: newopen
Type: featureenhancement

We had discussed this, but if it was added to add/removeClass, it would then need to propagate throughout all similar functions, which may not be worth the size. Still, I'll add it for 1.9 discussion.

comment:2 Changed 11 years ago by dmethvin

Type: enhancementfeature

Bulk change from enhancement to feature.

comment:3 Changed 11 years ago by mikesherov

+1, depends on size, but sure.

comment:4 Changed 11 years ago by dmethvin

-1, It's really easy to do yourself and a signature like this isn't consistent with others.

comment:5 Changed 11 years ago by dmethvin

Pull request here if we decide to land for 1.9: https://github.com/jquery/jquery/pull/988

comment:6 Changed 11 years ago by gnarf

-1, Potential issues with jQuery UI animate class as well

comment:7 Changed 11 years ago by mikesherov

Component: miscattributes

comment:8 Changed 11 years ago by mikesherov

Resolution: wontfix
Status: openclosed
Note: See TracTickets for help on using tickets.