fix inefficient repeated operation in 'hasClass' per #7