Skip to main content

Bug Tracker

Side navigation

#12380 closed feature (wontfix)

Opened August 23, 2012 07:53AM UTC

Closed October 29, 2012 04:32PM UTC

array as argument for addClass, removeClass

Reported by: dienase@gmail.com 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! :-)

Attachments (0)
Change History (8)

Changed August 23, 2012 02:17PM UTC by timmywil comment:1

component: unfiledmisc
keywords: → 1.9-discuss
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.

Changed September 09, 2012 01:11AM UTC by dmethvin comment:2

type: enhancementfeature

Bulk change from enhancement to feature.

Changed October 14, 2012 10:37PM UTC by mikesherov comment:3

+1, depends on size, but sure.

Changed October 20, 2012 02:40AM UTC by dmethvin comment:4

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

Changed October 20, 2012 02:42AM UTC by dmethvin comment:5

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

Changed October 22, 2012 05:45PM UTC by gnarf comment:6

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

Changed October 26, 2012 01:12PM UTC by mikesherov comment:7

component: miscattributes

Changed October 29, 2012 04:32PM UTC by mikesherov comment:8

resolution: → wontfix
status: openclosed