I just stumbled across Webshots's helper functions for adding and
removing class names:
http://p.webshots.net/js/chromeUtil.js
(Look for hasClass(), addClass(), delClass() and setClass() - whereas
the latter is optional.)
They are RegEx-based, so they *might* be more efficient than TW's
current equivalents.
I'm not an expert on this, but I thought it was worth mentioning.
-- F.