File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
docs/content/error/$parse Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -14,3 +14,32 @@ perform this check - it's up to the developer to not expose such sensitive and p
1414directly on the scope chain.
1515
1616To resolve this error, avoid Window access.
17+
18+ ### Common CoffeeScript Issue
19+
20+ Be aware that if you are using CoffeeScript, it automatically returns the value of the last statement in a
21+ function. So for instance
22+
23+ ```coffeescript
24+ scope.foo = ->
25+ window.open 'https://example.com'
26+ ```
27+
28+ compiles to something like
29+
30+ ```js
31+ scope.foo = function() {
32+ return window.open('https://example.com');
33+ };
34+ ```
35+
36+ You can see that this function will return the result of calling `window.open`, which is a `Window`
37+ object.
38+
39+ You can avoid this by explicitly returning something else from the function:
40+
41+ ```coffeescript
42+ scope.foo = ->
43+ window.open 'https://example.com'
44+ return true;
45+ ```
You can’t perform that action at this time.
0 commit comments