It feels like we haven't gotten to the core of the problem here - `properties.state` only triggers addClass('jstree-'+state) on the element, so it would point to some kind of a problem in the replacement callback below?

If you know why this workaround works, could you document it please?