Misc: allow forcing jQuery to return a factory in commonjs environments

Currently jQuery only returns a factory if global.document is not set. For a project I am working on I need jQuery to return a factory even if global.document is set. Here is a patch that will return the factory if global.document is set and global.JQUERY_FACTORY is also set.  In all other cases it will behave identically to before.