# wp-optimize/4.5.5/vendor/team-updraft/common-libs/src/updraft-theme/helpers/tu-html-element.js

WP-Optimize – Cache, Compress images, Minify &amp; Clean database to boost page speed &amp; performance, version 4.5.5. 41 lines.

- Page: https://pluginprobe.com/plugins/wp-optimize/4.5.5/code/vendor/team-updraft/common-libs/src/updraft-theme/helpers/tu-html-element.js
- Raw: https://pluginprobe.com/plugins/wp-optimize/4.5.5/raw/vendor/team-updraft/common-libs/src/updraft-theme/helpers/tu-html-element.js
- Modified: 2026-06-05T06:44:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-optimize/4.5.5/code/vendor/team-updraft/common-libs/src/updraft-theme/helpers/tu-html-element.js#L10-L20`.

```javascript
export class TUHTMLElement extends HTMLElement {
	tuRenderObserver = new MutationObserver(() => {
		this.tuRenderObserver.disconnect();

		// If the component has render function then render it.
		if (this.render) {
			this.render();
		}
	});

	/**
	 * Disconnected callback.
	 */
	disconnectedCallback() {
		if (super.disconnectedCallback) {
			super.disconnectedCallback();
		}

		this.tuRenderObserver.disconnect();
	}

	/**
	 * Connected callback.
	 */
	connectedCallback() {
		if (super.connectedCallback) {
			super.connectedCallback();
		}

		// Try to render the component.
		if (this.render) {
			this.render();
		}

		// If no child nodes present, then observe for changes in the child nodes and run the renderer when they are rendered.
		if (!this.hasChildNodes()) {
			this.tuRenderObserver.observe(this, { subtree: true, childList: true, characterData: true });
		}
	}
}

```
