Move checking snippet size into javascript.