How to reduce an excessive DOM size | Community
Skip to main content
supriya-hande
Level 4
December 12, 2023
Solved

How to reduce an excessive DOM size

  • December 12, 2023
  • 2 replies
  • 1033 views

Hello All,

 

In Lighthouse report for our website it provides recommendation: Avoid an excessive DOM size
When we create AEM components it adds some extra wrapper class thats why DOM is getting increased if there is page having more components.

Is there any way we can reduce DOM size? Like any setting in AEM to remove wrapper classes or datalayer classes.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Peter_Puzanovs

Hi Supriya,

 

To remove OOTB Generated divs you can add cq:noDecoration tag[1]

[1https://experienceleague.adobe.com/docs/experience-manager-65/developing/components/decoration-tag.html?lang=en]

 

In case if Lighthouse will still revert with issues, you would need to further look into your application.

 

Please note, that blank page with normal content should pass test, but page with heavy content on it may always trigger error just due to sheet size of the page on node elements.

 

Regards,

Peter

2 replies

Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
December 12, 2023

Hi Supriya,

 

To remove OOTB Generated divs you can add cq:noDecoration tag[1]

[1https://experienceleague.adobe.com/docs/experience-manager-65/developing/components/decoration-tag.html?lang=en]

 

In case if Lighthouse will still revert with issues, you would need to further look into your application.

 

Please note, that blank page with normal content should pass test, but page with heavy content on it may always trigger error just due to sheet size of the page on node elements.

 

Regards,

Peter

aanchal-sikka
Community Advisor
Community Advisor
December 13, 2023

@supriya-hande 

 

 

When a component is getting rendered on a page, an HTML element can be wrapped that component.

The reasons can be:

 

  • The component can only be edited if it is wrapped with an HTML element.
  • The wrapping element is used to apply HTML classes that provides Layout and Styling Information.

 

If you are trying to get rid of these, please be cautious and validate your components.

 

Are you observing this for OOTB WCM core components or custom components?

Aanchal Sikka