Background Information
There is an error in IE9 in which it considers that the NodeFilter property of the NodeFilter method is a callback function instead of an object containing a callback function.
In such a call:
document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, filter, false);
filter defined as "an object containing the acceptNode method" in Webkit and Gecko; however, in IE9 there is no mention of acceptNode at all - it expects a "callback method" without binding the object.
Actual question
So what is the best way to get around this problem without explicitly detecting the browser? In some cases, I need filter be a method, and in others, I need an object containing this method. Is there a clean way to do this? All of these browsers claim to support DOM 2.0, so I cannot verify this ...
Documents - Proof of Error
Here is a comparison of the documentation for each:
source share