Skip to content

Commit 36fd113

Browse files
authored
Merge pull request #125 from cdata/support-strict-mode
Explicitly detect browser global in strict mode.
2 parents 692e999 + 1deb860 commit 36fd113

6 files changed

+7
-7
lines changed

templates/amdWeb.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// Browser globals
2424
root.amdWeb = factory(root.b);
2525
}
26-
}(this, function (b) {
26+
}(typeof self !== 'undefined' ? self : this, function (b) {
2727
// Use b in some fashion.
2828

2929
// Just return a value to define the module export.

templates/amdWebGlobal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// Browser globals
2929
root.amdWebGlobal = factory(root.b);
3030
}
31-
}(this, function (b) {
31+
}(typeof self !== 'undefined' ? self : this, function (b) {
3232
// Use b in some fashion.
3333

3434
// Just return a value to define the module export.

templates/commonjsStrict.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// Browser globals
2828
factory((root.commonJsStrict = {}), root.b);
2929
}
30-
}(this, function (exports, b) {
30+
}(typeof self !== 'undefined' ? self : this, function (exports, b) {
3131
// Use b in some fashion.
3232

3333
// attach properties to the exports object to define

templates/commonjsStrictGlobal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// Browser globals
3030
factory((root.commonJsStrictGlobal = {}), root.b);
3131
}
32-
}(this, function (exports, b) {
32+
}(typeof self !== 'undefined' ? self : this, function (exports, b) {
3333
// Use b in some fashion.
3434

3535
// attach properties to the exports object to define

templates/returnExports.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// Browser globals (root is window)
2828
root.returnExports = factory(root.b);
2929
}
30-
}(this, function (b) {
30+
}(typeof self !== 'undefined' ? self : this, function (b) {
3131
// Use b in some fashion.
3232

3333
// Just return a value to define the module export.
@@ -51,7 +51,7 @@
5151
// Browser globals (root is window)
5252
root.returnExports = factory();
5353
}
54-
}(this, function () {
54+
}(typeof self !== 'undefined' ? self : this, function () {
5555

5656
// Just return a value to define the module export.
5757
// This example returns an object, but the module

templates/returnExportsGlobal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// Browser globals
3030
root.returnExportsGlobal = factory(root.b);
3131
}
32-
}(this, function (b) {
32+
}(typeof self !== 'undefined' ? self : this, function (b) {
3333
// Use b in some fashion.
3434

3535
// Just return a value to define the module export.

0 commit comments

Comments
 (0)