PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / trunk
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance vtrunk
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / team-updraft / common-libs / src / updraft-theme / helpers / tu-html-element.js

tu-html-element.js in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance trunk, at vendor/team-updraft/common-libs/src/updraft-theme/helpers/tu-html-element.js

41 lines 884 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 export class TUHTMLElement extends HTMLElement {
2 tuRenderObserver = new MutationObserver(() => {
3 this.tuRenderObserver.disconnect();
4
5 // If the component has render function then render it.
6 if (this.render) {
7 this.render();
8 }
9 });
10
11 /**
12 * Disconnected callback.
13 */
14 disconnectedCallback() {
15 if (super.disconnectedCallback) {
16 super.disconnectedCallback();
17 }
18
19 this.tuRenderObserver.disconnect();
20 }
21
22 /**
23 * Connected callback.
24 */
25 connectedCallback() {
26 if (super.connectedCallback) {
27 super.connectedCallback();
28 }
29
30 // Try to render the component.
31 if (this.render) {
32 this.render();
33 }
34
35 // If no child nodes present, then observe for changes in the child nodes and run the renderer when they are rendered.
36 if (!this.hasChildNodes()) {
37 this.tuRenderObserver.observe(this, { subtree: true, childList: true, characterData: true });
38 }
39 }
40 }
41