While there's no strict limit set in stone, Google Lighthouse and other testing tools flag websites with an excessive DOM size. Here's a breakdown of what these flags might indicate:
Warning: Google Lighthouse flags a warning when the body element of your page has more than approximately 800 nodes.
Error: If the body element surpasses roughly 1,400 nodes, Lighthouse throws an error.
Let's put this in context to understand what kind of websites might fall into these categories.
Without proper optimization, a single page with text content, images, a navigation menu, basic layout elements, and multiple plugins for forms or social sharing could easily reach around 800 DOM in WordPress.
On the other hand, pages exceeding 1,400 nodes are likely more complex and might include a higher number of elements. This can be like multiple sliders or carousels with large images, elaborate layouts with many nested elements and sections, or multiple embedded content.
These are just general examples. Don't let these illustrations scare you from building a custom website the way you want to. That said, if you want to make sure people stay on your site, then you will need to avoid excessive DOM size.