Skip to content

Commit

Permalink
Fix MutationObserver lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
tbranyen committed Apr 23, 2021
1 parent ef627b9 commit 41ca199
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/diffhtml/lib/transaction.js
Expand Up @@ -131,14 +131,14 @@ export default class Transaction {
this.config = config;

const isDirtyCheck = () => this.state.isDirty = true;
const hasMutationObserver = 'MutationObserver' in globalThis.window || EMPTY.OBJ;
const hasObserver = 'MutationObserver' in (globalThis.window || EMPTY.OBJ);

this.state = StateCache.get(mount) || /** @type {TransactionState} */ ({
measure: makeMeasure(this),
svgElements: new Set(),
scriptsToExecute: new Map(),
activeTransaction: this,
mutationObserver: hasMutationObserver && new globalThis.window.MutationObserver(isDirtyCheck),
mutationObserver: hasObserver && new globalThis.window.MutationObserver(isDirtyCheck),
});

this.tasks = /** @type {Function[]} */ (
Expand Down

0 comments on commit 41ca199

Please sign in to comment.