Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4620740
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:36:04+00:00 2026-05-22T02:36:04+00:00

Background Info A bug exists currently in IE9 where it thinks that the NodeFilter

  • 0

Background Info

A bug exists currently in IE9 where it thinks that the NodeFilter property of the createTreeWalker method is a callback function instead of an object containing a callback function.

In a call like this:

document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, filter, false);

filter is defined as “an object that contains a method acceptNode,” in Webkit and Gecko; however, in IE9, there’s no mention of acceptNode at all–it expects a “callback method,” without that object wrapping.

Actual Question

So, what’s the best way to work around this issue without doing explicit browser detection? In some instances I need filter to be a method, and in others I need it to be an object containing the method. Is there a clean way to accomplish this? All of these browsers claim to support DOM 2.0, so I can’t test on that…

Documents – Proof of Bug

Here’s a comparison of the documentation for each:

  1. W3C Spec
  2. Gecko
  3. Webkit
  4. Microsoft (“The NodeFilter is a callback function…” – WRONG)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:36:05+00:00Added an answer on May 22, 2026 at 2:36 am

    Well, I came up with one thing that works. Open to better alternatives:

    var filter = { acceptNode: function() {
         //do filtering...
    } };
    
    // Hackzilla.  A true W3C-compliant nodeFilter object isn't passed, and instead a "safe" one _based_ off of the real one.
    var safeFilter = filter.acceptNode;
    safeFilter.acceptNode = filter.acceptNode;
    
    document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, safeFilter, false);
    

    This works as nice browsers will call .acceptNode on the filter object, where bad ones will try and execute it immediately.

    Alternatives?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Info: File Replication is Lame Currently, we have a massive, high-traffic ASP.NET web
I have a very subtle bug that I'm having trouble identifying. Background: We have
Background info: We are currently 3 web programmers (good, real-life friends, no distrust issues).
Background info: I've set up a very simple .NET solution in VS2008 that contains
Background Info: I have a large body of text that I regularly encapsulate in
Quick background info: of the three database tables that are relevant for this question,
Relevant background info I've built a little software that can be customized via a
Background Info I am working on setting up a method for my company's developers
Some background info I am programming in a system that uses a proprietary programming
First a little background info: I have UIViewController that contains a UITableView. In the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.