EAGLESIX-3157: fix remaining jshint issues

Fix remaining JSHint issues with new code ported from 2.6.5 code.
Final part of an effort to cleanup various JSHint issues in one fell swoop so that we can keep things a bit cleaner going forward.
Slightly. For some reason we allowed `Document()` but not `new Document()` in the previous code when in reality neither are a reasonable thing to do.