From: Iskren Chernev Date: Sat, 9 Nov 2013 17:17:31 +0000 (-0800) Subject: Properly use global this to export moment X-Git-Tag: 2.5.0^2~37^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1c00e18e6978cdab4a681179f632a0a4f173838;p=thirdparty%2Fmoment.git Properly use global this to export moment This is one issue encountered in strict mode. Related to #1179 --- diff --git a/moment.js b/moment.js index ab52e62e2..3d7194001 100644 --- a/moment.js +++ b/moment.js @@ -12,6 +12,7 @@ var moment, VERSION = "2.4.0", + global = this, round = Math.round, i, @@ -2282,7 +2283,7 @@ // add `moment` as a global object via a string identifier, // for Closure Compiler "advanced" mode if (deprecate) { - this.moment = function () { + global.moment = function () { if (!warned && console && console.warn) { warned = true; console.warn( @@ -2293,7 +2294,7 @@ return local_moment.apply(null, arguments); }; } else { - this['moment'] = moment; + global['moment'] = moment; } }