JavascriptRenderer: split out validation functions and naive minification