Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access properties of the window object using "^" #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CheyenneForbes
Copy link

"^localStorage" => "window.localStorage"

"^localStorage" => "window.localStorage"
@@ -434,7 +434,7 @@ var jinja;
var get = function() {
var val, n = arguments[0], c = stack.length;
while (c--) {
val = stack[c][n];
val = (n[0] == '^' ? window[n.slice(1)] : stack[c][n]);
Copy link
Owner

@sstur sstur Jan 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's safe to assume that window exists. An example where window does not exist is when running in Node. I think we will need a better way to do window[n.slice(1)] part, perhaps a helper function getGlobal(n.slice(1)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants