Retrieving all DOM descendants
27th March 2003
First observation of the day: IE 5 for Windows doesn’t understand element.getElementsByTagName('*')
to retrieve all descendants of an element in the DOM. element.all
has the desired effect for that browser. So to retrieve all descendants in a way that will work on standards compliant browsers plus IE 5, the following seems to be the best bet:
var elements = element.all ? element.all : element.getElementsByTagName('*');
More recent articles
- OpenAI's new open weight (Apache 2) models are really good - 5th August 2025
- ChatGPT agent's user-agent - 4th August 2025
- The ChatGPT sharing dialog demonstrates how difficult it is to design privacy preferences - 3rd August 2025