[Pkg-javascript-commits] [node-acorn-jsx] 119/484: In browser loader, refer to global object as 'this', not 'self'
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:13 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit 4d8eeabf52d5db4ff3ad552848d82a8c6df2fbd8
Author: Marijn Haverbeke <marijnh at gmail.com>
Date: Wed May 8 15:16:06 2013 +0200
In browser loader, refer to global object as 'this', not 'self'
Closes #41
---
acorn.js | 2 +-
acorn_loose.js | 2 +-
index.html | 2 +-
util/walk.js | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/acorn.js b/acorn.js
index e62febd..8a7f25c 100644
--- a/acorn.js
+++ b/acorn.js
@@ -23,7 +23,7 @@
(function(mod) {
if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS
if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD
- mod(self.acorn || (self.acorn = {})); // Plain browser env
+ mod(this.acorn || (this.acorn = {})); // Plain browser env
})(function(exports) {
"use strict";
diff --git a/acorn_loose.js b/acorn_loose.js
index 8c781a3..9341a20 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -32,7 +32,7 @@
(function(mod) {
if (typeof exports == "object" && typeof module == "object") return mod(exports, require("./acorn")); // CommonJS
if (typeof define == "function" && define.amd) return define(["exports", "./acorn"], mod); // AMD
- mod(self.acorn || (self.acorn = {}), self.acorn); // Plain browser env
+ mod(this.acorn || (this.acorn = {}), this.acorn); // Plain browser env
})(function(exports, acorn) {
"use strict";
diff --git a/index.html b/index.html
index 93f8682..64b2526 100644
--- a/index.html
+++ b/index.html
@@ -17,7 +17,7 @@ with a <a href="acorn_loose.js">error-tolerant parser</a> and an
<a href="util/walk.js">abstract syntax tree walker</a>, defined in other files.</p> </td> <td class="code"> <div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">mod</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">exports</span> <span class="o">==</span> <span class="s2">"object"</span> <span class="o">&&</span> <span class="k">typeof</span> <span class="nx">module</span> <span class="o">==</span> <span class="s2">"object"</span><span class="p">)</span> <span class="k">return</span> <span class="nx">mod</span><span class="p">(</span><span class="nx">exports</span><span cla [...]
<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">define</span> <span class="o">==</span> <span class="s2">"function"</span> <span class="o">&&</span> <span class="nx">define</span><span class="p">.</span><span class="nx">amd</span><span class="p">)</span> <span class="k">return</span> <span class="nx">define</span><span class="p">([</span><span class="s2">"exports"</span><span class="p">],</span> <span class="n [...]
- <span class="nx">mod</span><span class="p">(</span><span class="nx">self</span><span class="p">.</span><span class="nx">acorn</span> <span class="o">||</span> <span class="p">(</span><span class="nx">self</span><span class="p">.</span><span class="nx">acorn</span> <span class="o">=</span> <span class="p">{}));</span> <span class="c1">// Plain browser env</span>
+ <span class="nx">mod</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">acorn</span> <span class="o">||</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">acorn</span> <span class="o">=</span> <span class="p">{}));</span> <span class="c1">// Plain browser env</span>
<span class="p">})(</span><span class="kd">function</span><span class="p">(</span><span class="nx">exports</span><span class="p">)</span> <span class="p">{</span>
<span class="s2">"use strict"</span><span class="p">;</span>
diff --git a/util/walk.js b/util/walk.js
index ea7eea1..e1e02f2 100644
--- a/util/walk.js
+++ b/util/walk.js
@@ -3,7 +3,7 @@
(function(mod) {
if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS
if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD
- mod(self.acorn.walk = {}); // Plain browser env
+ mod((this.acorn || (this.acorn = {})).walk = {}); // Plain browser env
})(function(exports) {
"use strict";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list