]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Properly use global this to export moment 1265/head
authorIskren Chernev <iskren.chernev@gmail.com>
Sat, 9 Nov 2013 17:17:31 +0000 (09:17 -0800)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 9 Nov 2013 17:17:31 +0000 (09:17 -0800)
This is one issue encountered in strict mode.

Related to #1179

moment.js

index ab52e62e2125bf4ef9a0f19d94a90c6009e3c577..3d7194001aa3869782ef47b87fce189ee705661d 100644 (file)
--- a/moment.js
+++ b/moment.js
@@ -12,6 +12,7 @@
 
     var moment,
         VERSION = "2.4.0",
+        global = this,
         round = Math.round,
         i,
 
         // 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(
                 return local_moment.apply(null, arguments);
             };
         } else {
-            this['moment'] = moment;
+            global['moment'] = moment;
         }
     }