backplane-import/test-import — Issue #47: Only toggle classes in setState() if the state is actually changing
Author: backplane-import
Created: 2011-10-15 01:51:55+00:00
State: open
Labels: type-enhancement

### Imported from backplanejs Google Code [issue 47](http://code.google.com/p/backplanejs/issues/detail?id=47).

Reporter
markbirbeck

Date
24 Apr 2010 5:02:33 PM UTC

The first thing that the setState() function does is to remove the 'on' and 'off'
classes for the state that it is dealing with.

This is as a precursor to setting the correct state, but is wasteful in the
situation where the class is already present (when enabling) or already absent
(when disabling).

It would be better to only remove the 'off' class when enabling, and remove
the 'on' class when disabling, and further, to check whether the class is
present.