About four years ago, I wrote an article for WebReference entitled, Creating a Cross-Browser (DOM) Expandable Tree. At the time, the DOM was still fairly new and Netscape Navigator 4.7 was still in use by many people, so I got a lot of questions such as, “how can I make this work in Netscape?” My answer was that you couldn’t, and I refused to figure out a way to do it because I believed that the DOM was the future. This was a fairly popular article at the time.

Recently, I received an email from someone pointing out that the tree didn’t work in the latest version of Opera. Having not looked at this code in about three years, I decided it would be fun to revisit it. I was able to figure out the problem (Opera didn’t like setAttribute() to set an element’s ID), and low and behold, this four-year-old code still works in all DOM-compliant browsers! I’ve updated the code and it can be downloaded in the Downloads section.

Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.