Check for config.observeMutations at runtime for cases when mutation isn't ready and runs to an out of memory error.

This commit is contained in:
Jeremy Lowrey 2019-11-25 15:04:59 -08:00
parent 516a62816c
commit cf96c3bcac

View File

@ -1417,6 +1417,9 @@ function observe(options) {
observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat; observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
mo = new MUTATION_OBSERVER(function (objects) { mo = new MUTATION_OBSERVER(function (objects) {
if (disabled) return; if (disabled) return;
if (!config.observeMutations) {
return;
}
toArray(objects).forEach(function (mutationRecord) { toArray(objects).forEach(function (mutationRecord) {
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) { if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
if (config.searchPseudoElements) { if (config.searchPseudoElements) {