simplify flatten test to avoid 'unresponsive script' issue in old IE testing
add/remove class now support array arguments as well