aboutsummaryrefslogtreecommitdiffstats
path: root/src/wrapper-factory.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapper-factory.js')
-rw-r--r--src/wrapper-factory.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/wrapper-factory.js b/src/wrapper-factory.js
new file mode 100644
index 000000000..212ff33bf
--- /dev/null
+++ b/src/wrapper-factory.js
@@ -0,0 +1,38 @@
+/*!
+ * jQuery JavaScript Library v@VERSION
+ * https://jquery.com/
+ *
+ * Copyright OpenJS Foundation and other contributors
+ * Released under the MIT license
+ * https://jquery.org/license
+ *
+ * Date: @DATE
+ */
+// Expose a factory as `jQueryFactory`. Aimed at environments without
+// a real `window` where an emulated window needs to be constructed. Example:
+//
+// const jQuery = require( "jquery/factory" )( window );
+//
+// See ticket trac-14549 for more info.
+function jQueryFactoryWrapper( window, noGlobal ) {
+
+"use strict";
+
+if ( !window.document ) {
+ throw new Error( "jQuery requires a window with a document" );
+}
+
+// @CODE
+// build.js inserts compiled jQuery here
+
+return jQuery;
+
+}
+
+function jQueryFactory( window ) {
+ "use strict";
+
+ return jQueryFactoryWrapper( window, true );
+}
+
+module.exports = { jQueryFactory: jQueryFactory };