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

document undefined? #426

Closed
gordanyang opened this issue Aug 28, 2018 · 5 comments
Closed

document undefined? #426

gordanyang opened this issue Aug 28, 2018 · 5 comments

Comments

@gordanyang
Copy link

in packages/core-js/internals/microtask.js
var node = document.createTextNode(''); should be var node = global.document.createTextNode(''); ??

else if (Observer && !(global.navigator && global.navigator.standalone)) {
    var toggle = true;
    var node = document.createTextNode('');
    new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
    notify = function () {
      node.data = toggle = !toggle;
    };
  // environments with maybe non-completely correct, but existent Promise
  } 
@zloirock
Copy link
Owner

document is a global variable - here is no difference between global.document. Does it cause an error for you?

@gordanyang
Copy link
Author

yes,in my case.
image
image

@marzelin
Copy link

Interesting. Where do you run the code - in service worker, web worker, node? Maybe there's a variable called document in the upper scope that shadows global document? AFAIK you cannot reassign document object on the main thread in any browser.

@zloirock
Copy link
Owner

zloirock commented Sep 12, 2018

Something strange. Could you add any info about your environment / a reproducible example?

@zloirock
Copy link
Owner

Closed as can't reproduce.

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

No branches or pull requests

3 participants