Reduce the Number of DOM Elements
What is the DOM?
How to Reduce the Number of DOM Elements
If you receive the suggestion to reduce the number of DOM elements, it is probably because your web page has over 1,500 HTML elements or have gone over 32 nodes. That is typically the threshold web performance tools set to trigger the warning. Before trying to resolve the warning, it is best to understand which specific elements may be contributing more to this than others. For example, plugins, chat widgets, bad coding, or even stylized and formatted text from a WYSIWYG editor, are some of the elements that cause excessive DOM size. Additionally, sometimes pages are too big, so splitting content out on multiple pages might be a better solution. Whatever it may be, review accordingly and try to optimize where possible.
Lighthouse is an open-source tool that is used to run an audit against your web pages and provides scores and suggestions for improving page performance, accessibility, SEO, and more.
PageSpeed Insights is a tool created by Google that reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.