Refactored JavaScript argument building to reduce multiple if checks, and added tests
Doc cleanup for By.jQuery