If you, like me, typically use the Mozilla Developer Network documentation as the source of truth for the browser JavaScript interface, you may be forgiven for assuming that only the first argument to document.createTreeWalker is required. As it turns out, Internet Explorer requires all four arguments to be passed explicitly. For a cross-browser-friendly tree walker with the defaults, create it like this:
document.createTreeWalker(someElement, NodeFilter.SHOW_ALL, null, false);
IE's implementation is consistent with DOM Level 2, which specifies four arguments, all of them required. Mozilla's is consistent with the DOM Living Standard, which specifies three arguments, only the first of which is required (Mozilla still allows the fourth argument, but it's marked obsolete).