Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#2455 closed defect (wontfix)

Add a dojo.html.toggleClass function

Reported by: [email protected] Owned by: Bryan Forbes
Priority: high Milestone:
Component: HTML Version: 0.4.1
Keywords: toggleClass Cc:
Blocked By: Blocking:


When working with classes I find myself constantly needing to add/remove a class from an element for various reasons (usually with onclick). It would be convenient to have a toggleClass function which would test to see if the class existed and added it on false and removed it on true. The same function should probably be written for style properties too.

I have written the dojo.html.toggleClass function for myself and it can be seen here: Source: Test:

Change History (5)

comment:1 Changed 15 years ago by [email protected]

Sorry...this was supposed to be a feature request.

comment:2 Changed 15 years ago by bill

Component: StyleHTML
Owner: changed from anonymous to Bryan Forbes

comment:3 Changed 15 years ago by guest

Since I posted this, I have come to learn more about Dojo, what it is about, and where it is headed. I know 1.0 is going to be based on core, 'needed' functionality, and I don't believe this falls into that model. It doesn't provide any extra functionality, it is just a combination of other functions. And, on the rare case a user wants this functionality, they can write it themselves.

Long story short, I won't be hurt if this doesn't make it in. In fact, I would rather it didn't. :)

comment:4 Changed 15 years ago by bill

Resolution: wontfix
Status: newclosed

OK then, I'm gonna close the request; thanks!

comment:5 Changed 15 years ago by Eugene Lazutkin

See #3227, which adds it.

Note: See TracTickets for help on using tickets.