Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12763 closed feature (wontfix)

Multiple arguments support in addClass

Reported by: spudly Owned by:
Priority: undecided Milestone: None
Component: attributes Version: 1.8.2
Keywords: 1.9-discuss Cc:
Blocked by: Blocking:

Description

It'd sure be nice if addClass() supported multiple string arguments for times when I'm using variables for the class names. That way instead of:

$el.addClass(foo).addClass(bar).addClass(baz);

... I could write:

$el.addClass(foo, bar, baz)

Change History (9)

comment:1 Changed 8 years ago by spudly

The other (nasty) alternative for adding multiple classes with one function call is:

$el.addClass(foo + ' ' + bar + ' ' + baz);

comment:2 Changed 8 years ago by mikesherov

Component: unfiledattributes
Keywords: 1.9-discuss added
Milestone: None1.9
Status: newopen

This probably won't happen, but we'll bring it up for discussion to be included in jQuery 1.9.

comment:3 Changed 8 years ago by dmethvin

-1, Not needed.

Version 0, edited 8 years ago by dmethvin (next)

comment:4 Changed 8 years ago by mikesherov

-1

comment:5 Changed 8 years ago by gnarf

-1, Might actually cause some issues with the jQuery UI "animate class" signature.

comment:6 Changed 8 years ago by david71rj

Maybe just accept an array?

  $el.addClass(["a b", foo, "c d"]);
  // Equivalent to: "a b foo-class c d"

comment:7 Changed 8 years ago by Rick Waldron

comment:8 Changed 8 years ago by dmethvin

Resolution: wontfix
Status: openclosed

Voted out.

comment:9 Changed 8 years ago by dmethvin

Milestone: 1.9None
Note: See TracTickets for help on using tickets.