Port add_class and remove_class functionality over to raw JS

fixed two bugs in the core add and remove class methods, ported over from framework based to raw JS