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

Use window.document #710

Merged
merged 2 commits into from
Oct 28, 2016
Merged

Use window.document #710

merged 2 commits into from
Oct 28, 2016

Conversation

alampros
Copy link
Contributor

Allows for webpack server rendering (when the top-level document is not defined).

Potential fix for #474.

Allows for webpack server rendering.
@Rycochet
Copy link
Collaborator

Downside of this is that it'll break even more on Node where window doesn't exist... Maybe try a check like window ? window.document : undefined ?

@VadimZhiltsov
Copy link

You can use hack to get global object on an environment:

var global = (function(){ return this; })()

it is function's feature, when it doesn't has context, it has global context

@Rycochet
Copy link
Collaborator

Doesn't work with "use strict" - so a bad idea to try and rely on undefined behaviour. Technically (window || global) will get the right one, but we're only interested in window, as the code referencing it is not for use in Node etc.

@alampros
Copy link
Contributor Author

@Rycochet good call. I added the check.

@Rycochet Rycochet merged commit 24e244e into julianshapiro:master Oct 28, 2016
Rycochet pushed a commit that referenced this pull request Aug 3, 2020
* Use window.document

Allows for webpack server rendering.

* Check window exists
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.

3 participants