Skip to content

Commit

Permalink
fix microtask implementation in engines with MutationObserver, but …
Browse files Browse the repository at this point in the history
…without `document`, #865, #866
  • Loading branch information
zloirock committed Oct 28, 2020
1 parent f17c653 commit 08d2d44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@
##### Unreleased
- `String#replaceAll` moved to the stable ES, [per Jun TC39 meeting](https://github.com/tc39/notes/blob/master/meetings/2020-06/june-2.md#stringprototypereplaceall-for-stage-4)
- `process.nextTick` have a less priority when `Promise` in the microtask implementation, [#855](https://github.com/zloirock/core-js/issues/855)
- Fixed microtask implementation in engines with `MutationObserver`, but without `document`, [#865](https://github.com/zloirock/core-js/issues/865), [#866](https://github.com/zloirock/core-js/issues/866)
- Added a workaround for 3rd party `Reflect.set` polyfill bug, [#847](https://github.com/zloirock/core-js/issues/847)

##### 3.6.5 - 2020.04.09
Expand Down
3 changes: 2 additions & 1 deletion packages/core-js/internals/microtask.js
Expand Up @@ -5,6 +5,7 @@ var macrotask = require('../internals/task').set;
var IS_IOS = require('../internals/engine-is-ios');

var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
var document = global.document;
var process = global.process;
var Promise = global.Promise;
var IS_NODE = classof(process) == 'process';
Expand Down Expand Up @@ -34,7 +35,7 @@ if (!queueMicrotask) {
};

// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
if (MutationObserver && !IS_IOS && !IS_NODE) {
if (!IS_IOS && !IS_NODE && MutationObserver && document) {
toggle = true;
node = document.createTextNode('');
new MutationObserver(flush).observe(node, { characterData: true });
Expand Down

0 comments on commit 08d2d44

Please sign in to comment.