js interface: Only use short form if string is a valid identifier.