-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
global object when window.global is defined #1189
Comments
Thanks for the report. Maybe |
Or maybe adding a check that global.appendChild is not defined |
@JamesKyburz Thanks for the suggestion. I was also wondering if a more specific test would make sense, but I was thinking of going the other way, like maybe checking for |
@jmm true that. Maybe go with your first comment. A too big change could as you pointed out break stuff. |
I think the convention of global being the global is pretty good and doesn't get in the way. and in case there is an element with the id global, you can get to it by doing:
I think trying to access global properties directly is an anti-pattern anyway. Any global variables should be explicitly be accessed by using |
@nmn I think you may have misinterpreted the issue. The problem is that if there is a |
I think that in the bundle |
@nmn Have you looked at the source? Or verified those theories by testing it? |
If the underlying website have a Maybe The check for global should not be what do you think? |
@jmm Sorry, my knowledge about this was based on an old version of browserify. |
Would be better yes @yanatan16 |
More than a year has passed before this issue was created. |
Any news about this problem? We just spent 2 hours to find that one of our client had a |
We'd like to see this issue get fixed as well. It's unfortunate in situations where your company or team does not have control over the DOM context that has an element with |
@ltressens @acemtp @mrak FWIW this would need to be fixed in |
Looks like there's something missing that would satisfy collaboratos, so the browserify/insert-module-globals#48 PR doesn't get to be applied. This is somehow painful for all of us that are building libs to work in non-controlled DOM environments. Has anyone at least come with some workaround in the meanwhile??? |
It seems that the global object can be
window.global
as opposed towindow
when it exists. This is a problem when some third party javascript decides to insert<div id="global">
, and now two scripts can't refer to the same global object.The text was updated successfully, but these errors were encountered: