Is there a limit to the levels of nesting in the DOM tree?

Question

In the context of this exercise, describing the DOM tree, is there a limit to the levels of nesting in the DOM tree?

Answer

No, there is no real set limit to how many levels of nesting there can be in the DOM tree.

The only limitation on nesting might be one caused by browser memory, which can possibly run out if there are too many elements on a page. Typically, elements should be nested when necessary, and the HTML should be concise if possible, so it is entirely avoidable and very rare and unlikely to happen.

1 Like