Optimize DOM in Oxygen Builder

TABLE OF CONTENTS
Oxygen is known as one of the WordPress website builders with the best loading speed today.
Fastest doesn't mean it's the best. When first launched in 2019, Oxygen Builder was like a breath of fresh air. It is completely different from the rest in the WordPress Page Builder and Theme Builder ecosystem.
Oxygen is the pioneer of Speed Builder. To this day, there are dozens of Builders that offer amazing speeds similar to Oxygen, typically Bricks, Cwicly, Zion,... Along with the release of Breakdance, a new product from the same family as Oxygen, it seems Oxygen is gradually falling behind.
But it won't go away, we need to make it better.
Simply put, the DOM is the test buttons in the HTML language.
<html>
.<head>, <body>, <section>, <div>
and many other types of elements. These tags are HTML elements, and each tag can contain child nodes.<p>
, <span>
, and even in tags like <title>
or <h1>
. This node has no child nodes.For example I have HTML code like this:
<html>
<head></head>
<body>
<section>
<h1>heading</h1>
</section>
</body>
</html>
The DOM structure of the above code will be understood like this:
document
├── head
└── body
└── section
└── h1
In there:
document
is the document node of the HTML document.head
and body
are element nodes.section
is an element node that contains child nodes h1
.h1
is a text node.Large DOM trees can slow down your site's performance:
document.querySelectorAll('li')
, you could accidentally store references to a very large number of nodes, which could overwhelm the available memory on the user's device.After reading the above section, you can have a basic understanding of the DOM structure in the website.
To optimize the DOM, you need to limit the nesting of elements if not necessary.
For example above, tag <h1>
Can completely lie on its own without needing to be nested inside <section>
In Oxygen, when you add a section, it will create an additional container inside and you cannot do anything with the container element inside. This unintentionally creates an extra DOM node if that element is not Full-width.
To overcome this problem, we can create each type separately from Section → Container using the tools available in Oxygen and save it as "Re-usable part" to use anytime, anywhere.
Create Section:
Create Container:
"ct-section-inner-wrap"
.width = calc(100% - 20px)
. 20px is the padding divided equally into the left and right sides, 10px on each side.Or you can Import the json code below to refer to the sample you created.
Section:
{"component":{"id":14,"name":"ct_div_block","options":{"ct_id":14,"ct_parent":0,"selector":"div_block-14-4205","original":{"tag":"section","margin-top":"50","margin-bottom":"50"},"nicename":"ARTRU-section","activeselector":false},"depth":1},"classes":{}}
Containers:
{"component":{"id":16,"name":"ct_div_block","options":{"ct_id":16,"ct_parent":0,"selector":"div_block-16-4205","original":{},"nicename":"ARTRU-container","classes":["ct-section-inner-wrap"],"activeselector":false},"depth":1},"classes":{"ct-section-inner-wrap":{"key":"ct-section-inner-wrap","original":{"width-unit":" ","width":"calc(100% - 20px)"}}}}
Related Articles