cleaned up applClassNamesRecursively
Now works as a library in vanilla es5.