There are updates to this page that haven't been applied because you've entered text. Refresh this page to see updates.
Hide this message.

Answer Stats

If I was teaching a class on data structures and I added the constraint that the class would only talk about data structures used in the DOM tree (in the Webkit, Gecko, or Trident implementations), what data structures could I cover?
Matt's AnswerView 2 Other Answers
Matt BastaMatt Basta, former Firefox Marketplace eng... (more)
The data structures are perhaps less interesting than you'd imagine.

The actual DOM hierarchy is composed of nodes with lists of child nodes and attributes. The lists are either double linked lists or arrays. Probably the latter, I'd imagine. The node also has properties for things like the parent node.

Separately from that, a hash table stores node to ID mappings (for `getElementById`). Another hash table stores lists of nodes for node to className mappings.