From 9fad7c1e0d32f99344faa1ca4e4627fc7d89bcd9 Mon Sep 17 00:00:00 2001 From: David Heidrich Date: Fri, 12 Feb 2016 17:28:07 +0100 Subject: [PATCH] fix(ie10): fix IE10 problems with treeWalker --- src/main/util/Util.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/util/Util.js b/src/main/util/Util.js index 41f94a4..666563c 100644 --- a/src/main/util/Util.js +++ b/src/main/util/Util.js @@ -407,10 +407,8 @@ class Util { if (!node) { return false; } - const args = [node, type]; - if (filter) { - args.push(filter); - } + const args = [node, type, filter || (() => true), false]; + args.push(false); const walker = document.createTreeWalker(...args); while (walker.nextNode()) { if (!func(walker.currentNode)) { @@ -427,9 +425,7 @@ class Util { * @param {Object} [filter] skips empty text nodes by default * @returns {boolean} true if function did abort walk */ - static walkTextNodes(el, func, filter = { - acceptNode: (node) => !Util.nodeIsEmpty(node) - }) { + static walkTextNodes(el, func, filter = (node) => !Util.nodeIsEmpty(node)) { return Util.walkDom(el, func, NodeFilter.SHOW_TEXT, filter); }