Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
1f67d07c
Commit
1f67d07c
authored
Jul 04, 2013
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support CommonJS environments by accentuating the need for a window with a document. Fixes #13768.
parent
aee46598
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
28 deletions
+40
-28
Gruntfile.js
Gruntfile.js
+0
-2
exports.js
src/exports.js
+0
-24
intro.js
src/intro.js
+35
-1
outro.js
src/outro.js
+5
-1
No files found.
Gruntfile.js
View file @
1f67d07c
...
@@ -68,8 +68,6 @@ module.exports = function( grunt ) {
...
@@ -68,8 +68,6 @@ module.exports = function( grunt ) {
{
flag
:
"offset"
,
src
:
"src/offset.js"
,
needs
:
[
"css"
]
},
{
flag
:
"offset"
,
src
:
"src/offset.js"
,
needs
:
[
"css"
]
},
{
flag
:
"dimensions"
,
src
:
"src/dimensions.js"
,
needs
:
[
"css"
]
},
{
flag
:
"dimensions"
,
src
:
"src/dimensions.js"
,
needs
:
[
"css"
]
},
{
flag
:
"deprecated"
,
src
:
"src/deprecated.js"
},
{
flag
:
"deprecated"
,
src
:
"src/deprecated.js"
},
"src/exports.js"
,
"src/outro.js"
"src/outro.js"
]
]
}
}
...
...
src/exports.js
deleted
100644 → 0
View file @
aee46598
if
(
typeof
module
===
"object"
&&
module
&&
typeof
module
.
exports
===
"object"
)
{
// Expose jQuery as module.exports in loaders that implement the Node
// module pattern (including browserify). Do not create the global, since
// the user will be storing it themselves locally, and globals are frowned
// upon in the Node module world.
module
.
exports
=
jQuery
;
}
else
{
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
define
(
"jquery"
,
[],
function
()
{
return
jQuery
;
}
);
}
}
// If there is a window object, that at least has a document property,
// define jQuery and $ identifiers
if
(
typeof
window
===
"object"
&&
typeof
window
.
document
===
"object"
)
{
window
.
jQuery
=
window
.
$
=
jQuery
;
}
src/intro.js
View file @
1f67d07c
...
@@ -11,7 +11,41 @@
...
@@ -11,7 +11,41 @@
*
*
* Date: @DATE
* Date: @DATE
*/
*/
(
function
(
window
,
undefined
)
{
(
function
(
window
,
factory
)
{
if
(
typeof
module
===
"object"
&&
typeof
module
.
exports
===
"object"
)
{
// Expose a jQuery-making factory as module.exports in loaders that implement the Node
// module pattern (including browserify).
// This accentuates the need for a real window in the environment
// e.g. var jQuery = require("jquery")(window);
module
.
exports
=
function
(
w
)
{
w
=
w
||
window
;
if
(
!
w
.
document
)
{
throw
new
Error
(
"jQuery requires a window with a document"
);
}
return
factory
(
w
);
};
}
else
{
// Execute the factory to produce jQuery
var
jQuery
=
factory
(
window
);
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
define
(
"jquery"
,
[],
function
()
{
return
jQuery
;
});
}
}
// Pass this, window may not be defined yet
}(
this
,
function
(
window
,
undefined
)
{
// Can't do this because several apps including ASP.NET trace
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// the stack via arguments.caller.callee and Firefox dies if
...
...
src/outro.js
View file @
1f67d07c
// Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
return
(
window
.
jQuery
=
window
.
$
=
jQuery
);
})
(
window
);
}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment