Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#2455 closed defect (wontfix)

Add a dojo.html.toggleClass function

Reported by: rhodes.aaron@… Owned by: Bryan Forbes
Priority: high Milestone:
Component: HTML Version: 0.4.1
Keywords: toggleClass Cc:
Blocked By: Blocking:

Description

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: http://infinitysphere.no-ip.org/wsvn/foobar/trunk/dojo_svn_20070124/src/html/style.js?op=file&rev=6 Test: http://infinitysphere.no-ip.org/wsvn/foobar/trunk/dojo_svn_20070124/tests/style/test_style_css_toggle.html?op=file&rev=4

Change History (5)

comment:1 Changed 13 years ago by rhodes.aaron@…

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

comment:2 Changed 12 years ago by bill

Component: StyleHTML
Owner: changed from anonymous to Bryan Forbes

comment:3 Changed 12 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 12 years ago by bill

Resolution: wontfix
Status: newclosed

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

comment:5 Changed 12 years ago by Eugene Lazutkin

See #3227, which adds it.

Note: See TracTickets for help on using tickets.