Ported JS execution from 2.0 to 1.X.