What If The DOM Was Already Reactive?

Modern frontend development often starts by replacing the browser. According to MDN, the DOM itself is already a programmable, tree-based representation of documents.

Illustration for What If The DOM Was Already Reactive?
Building software is the process of making decisions.

DOMPP and the Case for Browser-Native Reactivity

Documentation: https://dompp.digital/

GitHub Repository: https://github.com/dimaspandu/dompp

Modern frontend development often starts by replacing the browser.

According to MDN, the DOM itself is already a programmable tree-based representation of documents that browsers expose as a live runtime interface.

Modern browsers already provide:

  • retained rendering trees
  • event propagation systems
  • node identity semantics
  • mutation primitives
  • hierarchical ownership structures

At the same time, frontend engineering evolved increasingly sophisticated abstraction layers above the DOM:

  • virtual DOM systems
  • reactive graphs
  • hydration runtimes
  • template compilers
  • ownership reconstruction layers

Academic and industry discussions around UI runtimes, retained-mode rendering, reconciliation, and fine-grained reactivity have continuously explored how developers can manage increasingly complex UI systems while minimizing unnecessary work and preserving predictable rendering semantics.

DOMPP proposes a different direction.

What if more of those runtime semantics evolved directly at the browser layer instead of existing primarily inside frameworks?

For years, frontend ecosystems increasingly moved toward avoiding direct DOM mutation.

And historically, that made sense.

The browser DOM was often considered:

  • slow
  • imperative
  • difficult to compose
  • difficult to reason about
  • too low-level for modern applications

So the industry moved upward.

Developers increasingly authored:

  • virtual trees
  • declarative templates
  • reactive graphs
  • compiled component systems

The browser became the rendering target.

Not the runtime itself.

But what if the browser was never the actual limitation?

The Browser Already Has a Runtime

The DOM is already:

  • retained
  • mutable
  • event-driven
  • identity-based
  • hierarchical
  • stateful

Modern browsers already:

  • own the rendering tree
  • schedule rendering
  • manage event propagation
  • preserve node identity
  • expose direct mutation primitives

For example:

const button =
document.createElement("button");

That line already creates a retained runtime object.

Not a description.

Not a template.

Not a virtual node.

An actual runtime node.

So the interesting question becomes:

What exactly is missing?

Why Frameworks Emerged

The issue was never purely capability.

Browsers already exposed powerful mutation primitives.

The problem was ergonomics and composability.

Native DOM mutation often feels structurally fragmented:

const el = document.createElement("div");

el.textContent = "Hello";

el.style.color = "tomato";

el.classList.add("card");

el.appendChild(button);

el.addEventListener("click", handler);

Every subsystem evolved independently.

Text mutation:

el.textContent = "Hello";

Style mutation:

el.style.color = "tomato";

Child mutation:

el.appendChild(child);

Attribute mutation:

el.setAttribute("role", "button");

Event mutation:

el.addEventListener("click", handler);

Each subsystem exposes:

  • different semantics
  • different APIs
  • different update patterns
  • different ergonomics

As applications became larger and more interactive, frameworks increasingly solved:

  • declarative composition
  • predictable update flow
  • reusable mutation patterns
  • ownership semantics
  • ergonomic tree construction

DOMPP explores whether many of those ergonomics could emerge directly from DOM mutation itself.

Consistent Mutation Semantics

One of the central ideas in DOMPP is mutation consistency.

The proposal treats mutation semantics as a unified runtime model.

el.setText(...)

el.setStyles(...)

el.setAttributes(...)

el.setChildren(...)

el.setEvents(...)

But consistency in DOMPP is not only about naming.

It is also about lifecycle semantics.

In traditional DOM APIs, creation and mutation often use different mental models.

This becomes especially visible when dealing with child trees.

Initial construction may use:

const card =
document.createElement("div");

card.appendChild(title);

card.appendChild(description);

Later mutations may require entirely different APIs depending on intent:

card.replaceChildren(nextChild);
card.replaceChild(nextChild, oldChild);
card.prepend(banner);
card.append(footer);
card.innerHTML = "<div>...</div>";

The browser exposes many powerful capabilities.

But the mutation semantics themselves become increasingly fragmented.

DOMPP intentionally treats both initial construction and subsequent mutation through the same semantic model.

Initial tree:

card.setChildren(title, description)

Subsequent mutation:

card.setChildren(nextChild)

Or:

card.setChildren(
banner,
title,
description,
footer
)

The same principle also applies to:

  • text
  • attributes
  • styles
  • events
  • state

This creates a significantly more predictable mental model.

Mutation APIs are designed around semantic consistency rather than DOM subsystem boundaries.

Chainable Runtime Composition

Another core idea in DOMPP is chainability.

Instead of treating DOM mutation as disconnected imperative statements, DOMPP explores mutation as a composable runtime flow.

Traditional DOM construction often becomes structurally fragmented:

const card =
document.createElement("div");

card.classList.add("card");

const title =
document.createElement("h2");

title.textContent = "DOMPP";

const description =
document.createElement("p");

description.textContent =
"Browser-native runtime exploration";

card.appendChild(title);

card.appendChild(description);

The runtime tree exists, but its structure is visually scattered.

DOMPP introduces a more declarative retained-mode composition model.

const card =
document
.createElement("div")
.setAttributes({
class: "card"
})
.setStyles({
color: "tomato"
})
.setChildren(
document
.createElement("h2")
.setText("DOMPP"),
document
.createElement("p")
.setText(
"Browser-native runtime exploration"
)
);

The structure becomes visually representative of the runtime tree itself.

Each mutation returns the same runtime node.

This enables:

  • fluent composition
  • readable runtime flow
  • deterministic mutation sequencing
  • reusable tree construction
  • direct ownership visibility

Importantly, chainability is not only syntactic sugar.

It changes how developers mentally model the runtime.

Instead of:

Create node.
Then mutate it repeatedly.

The mental model becomes:

Construct runtime behavior progressively.

This aligns naturally with retained-mode rendering semantics already present inside the browser.

DOMPP explores what happens when those semantics become more ergonomic and composable at the platform level.

DOMPP

DOMPP (DOM++) is an experimental browser-native runtime proposal.

The idea is intentionally simple:

What if DOM mutation itself became ergonomic, composable, and reactive?

Instead of introducing:

  • virtual DOM trees
  • template compilers
  • component ownership systems
  • synthetic rendering layers

DOMPP explores extending the DOM directly.

The proposal introduces chainable mutation primitives like:

const card =
document.createElement("div")
.setText("Hello DOMPP")
.setStyles({
color: "tomato"
});

Direct deterministic mutation without introducing an additional rendering runtime abstraction.

Runtime Architecture Comparison

Traditional frontend runtime flow compared to DOMPP’s browser-native runtime model.

Deterministic Mutation

One of the goals behind DOMPP is deterministic runtime behavior.

Instead of describing UI through hidden reconciliation systems, DOMPP mutations are explicit.

el.setText("Hello")

means:

Mutate the node text.

Nothing more.

Likewise:

el.setChildren(...)

means:

Replace the child structure directly.

No hidden virtual tree.

No reconciliation engine.

No synthetic ownership graph.

The runtime behavior is intentionally transparent.

Stateful DOM Nodes

DOMPP also explores attaching state directly to DOM elements.

const counter =
document
.createElement("button")
.setState({
count: 0
})
.setText(({ state }) => {
return (
`Count: ${state.count}`
);
})
.setEvents(({ state, setState }) => ({
click() {
setState({
count:
state.count + 1
});
}
}));

This changes the mental model significantly.

State is no longer owned by:

  • a component instance
  • a virtual node
  • a framework runtime

Instead:

State is attached directly to DOM nodes.

The DOM itself becomes the ownership layer.

Ownership Model Shift

Traditional frameworks often separate runtime ownership from the DOM, while DOMPP explores attaching state and behavior directly to DOM nodes.

DOM Identity As Runtime Identity

This is one of the most important ideas in the proposal.

In many modern frameworks, identity is reconstructed indirectly through:

  • keys
  • reconciliation
  • virtual trees
  • diffing algorithms

DOMPP explores a different assumption:

DOM node references ARE runtime identity.

Identity Preservation

In DOMPP, runtime identity is tied directly to DOM node references. Reusing the same node preserves state, while replacing the node resets ownership and local state.

If the same DOM node reference survives:

  • local state survives
  • event listeners survive
  • runtime ownership survives

If a node is replaced entirely:

  • identity changes
  • state resets
  • ownership resets

This leads to a very different runtime philosophy.

Instead of simulating ownership above the DOM, ownership already exists inside the DOM itself.

Enhancement Instead of Hydration

Modern SSR systems often rely on hydration.

Hydration attempts to reconnect runtime ownership to server-rendered HTML.

But hydration also introduces complexity:

  • ownership reconstruction
  • tree matching
  • runtime bootstrapping
  • reconciliation boundaries

DOMPP explores another direction:

Enhancement.

Instead of recreating ownership, existing DOM nodes are directly assimilated.

Hydration vs Enhancement

Traditional hydration reconstructs runtime ownership from server-rendered HTML, while DOMPP explores enhancing the existing DOM tree directly.
document
.getElementById("app")
.setEnhancement(({
childNodes,
state,
setState
}) => {
// enhance existing DOM directly
});

The existing DOM tree already exists.

The runtime simply attaches behavior to it.

This approach treats server-rendered HTML as an already-owned retained tree rather than a template waiting to be reconstructed.

Fine-Grained Signals

DOMPP also supports optional fine-grained reactivity.

const [count, setCount] =
document.createSignal(0);

Signals allow reactive subscriptions to rerun only where needed.

But importantly:

Fine-grained mode is optional.

DOMPP does not attempt to replace the mutation model with signals.

Signals exist as an additional runtime layer.

The original stateful mutation runtime still works independently.

This is important philosophically.

The proposal is not trying to force a single reactive architecture.

Instead, it explores how reactive semantics could emerge directly from browser-native primitives.

Building On Existing Browser Semantics

One interesting aspect of DOMPP is that many behaviors already partially exist on the web platform.

For example:

<div id="app"></div>

can already become:

app.setChildren(...)

because browsers expose named element access through the global window object.

DOMPP intentionally leans into these browser-native semantics.

The goal is not to replace the browser.

The goal is to explore what happens when the browser itself becomes the runtime abstraction layer.

What About Frameworks?

DOMPP is not anti-framework.

This is not:

  • “React killer” discourse
  • framework replacement marketing
  • performance benchmark warfare

The proposal explores a different question entirely.

What if frameworks became optional layers instead of mandatory runtimes?

What if the platform itself evolved stronger runtime primitives?

Could frameworks eventually build on top of browser-native reactive semantics rather than recreating ownership systems from scratch?

Could compilers target native runtime semantics instead of shipping custom rendering engines?

Could the browser eventually expose mutation primitives expressive enough that many framework abstractions become thinner?

DOMPP explores these possibilities.

Browser-Native Runtime Exploration

At its core, DOMPP is less about utility APIs and more about runtime philosophy.

It explores:

  • deterministic mutation
  • DOM-native ownership
  • identity preservation
  • enhancement semantics
  • optional fine-grained reactivity
  • browser-native runtime composition

And perhaps most importantly:

It asks a simple but interesting question.

What if the browser was already the runtime?

References

  1. MDN Web Docs — Document Object Model (DOM) https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model
  2. MDN Web Docs — Node https://developer.mozilla.org/en-US/docs/Web/API/Node
  3. MDN Web Docs — Element https://developer.mozilla.org/en-US/docs/Web/API/Element
  4. React Documentation — Render and Commit https://react.dev/learn/render-and-commit
  5. SolidJS — Fine-Grained Reactivity https://www.solidjs.com/
  6. Incremental DOM — Google https://github.com/google/incremental-dom
  7. React Design Principles https://legacy.reactjs.org/docs/design-principles.html
  8. DOMPP Documentation https://dompp.digital/
  9. DOMPP GitHub Repository https://github.com/dimaspandu/dompp

Closing Thoughts

Maybe the next evolution of frontend runtimes is not replacing the browser.

But embracing it more completely.