top of page
  • Writer's pictureBrent D. Payne

Avoid excessive DOM width

The referenced web resource contains a node within the Document Object Model (DOM) that exceeds the standard limit of 60 child nodes.

Why is this important?

Larger DOM trees can affect your site's performance adversely, despite the ability of browsers to manage them, and here is how:

  • Network efficiency and load performance. Delivering a bulky DOM can entail stubborn loads of redundant bytes. Slow page responses often result when the browser labors to parse numerous nodes that do not impact the initial visual offerings.

  • Runtime performance. Interactions with the page from users and scripts necessitate frequent recalculations by the browser regarding node positioning and styles. A combination of an extensive DOM and complex CSS can drastically decelerate the rendering process.

  • Memory performance. Utilizing general queries, for example, document.querySelectorAll('li'), could inadvertently bind an exhaustive list of node references in memory, potentially maxing out the devices your audience is using.

What does the Optimization check?

The Optimization becomes active for any internal web resource where the largest DOM width exceeds the 60-element threshold.

Examples that trigger this Optimization:

The Optimization is activated for URLs with a DOM that has a node count surpassing the 60-child benchmark, such as in the following representation:

<!-- Example of excessive DOM structure --><div>  <!-- (60+ child elements go here) --></div>

How do you resolve this issue?

The characteristics of an ideal DOM tree include:

  • A total node count that is below 1500.

  • A depth not exceeding 32 nodes.

  • Parent nodes should each have no more than 60 child nodes.

It's advisable to generate DOM nodes on an as-needed basis and to eliminate them post-use.

Examining your server's DOM delivery can reveal nodes that remain unseen. These could be extracted from the delivery and generated only in response to user interactions, such as clicks or scrolling behaviors.

Consider the following inquiries:

  • Do you employ nested tables to arrange layout?

  • Are additional <div>s being implemented merely to resolve layout challenges?

  • Can your markup be organized in a more semantically appropriate and efficient method?

Further Reading



bottom of page