client: remove dependency on $document

Part of an effort to remove dependency on jQuery

$ instances left: 551