Shouldn't you check with cssClassSub.hasOwnProperty(subName) ?