DOMPP (DOM++)
What if the DOM was already reactive? The DOM API we might actually need.
Chapter 1 — The Beginning
In the beginning, there was the DOM. And the DOM was verbose.
Every UI was assembled by hand. Create a node. Set a property. Append a child. Repeat. It worked, but the code grew like vines.
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);
Twenty lines to make a card. And every update meant touching the same nodes again, carefully, by hand.
Chapter 2 — The Library Era
So we invented libraries. jQuery made selection and mutation feel effortless. Backbone and AngularJS gave us structure and data binding. The web got faster to build.
But the DOM was still the same DOM underneath. The libraries just hid it.
Chapter 3 — The React Revolution
Then React arrived and changed everything. Declarative components. A virtual DOM. Diff and patch. Suddenly developers could think in terms of UI trees instead of mutation steps.
The developer experience won. React became the default mental model for a generation.
But the cost was a layer between you and the platform. A runtime. A reconciliation engine. A bundle.
Chapter 4 — The Performance Wars
Vue, Svelte, SolidJS, and others entered the arena. Each offered a different answer to the same question: how do we make UI fast and reactive?
Signals. Fine-grained updates. Compilers. Each framework optimized harder, shipped smarter, and fought for milliseconds.
Meanwhile, the platform itself stayed still.
Chapter 5 — The AI Shift
Now AI can generate vanilla code from a single prompt. The output runs fast. No framework. No bundle. Just the browser.
But open the generated source and you find imperative mutation scattered everywhere. Create this. Set that. Append here. Remove there. Fast to run, hard to read, harder to maintain.
The speed is real. The maintainability is not.
Chapter 6 — What We Actually Need
Strip away the hype and the question is simple. We need to assemble UI easily. We need it to stay maintainable. We need performance that is stable, not fragile.
So why not let the browser provide the APIs directly?
Why not make the DOM itself reactive, composable, and safe — so that the platform carries the weight, not a library?
DOM++ — A Preview
DOM++ is a slice of a larger effort: the-future-of-the-browser, a browser runtime exploration (Rust, V8, and more) that aims to enhance the DOM itself. The hope is that this work can also serve as a proposal to MDN and the web platform.
DOM++ itself is a preview of how those new APIs might be used. Native-first. Explicit. No virtual DOM.
JSX Support — Declarative Syntax, DOM++ APIs
DOM++ also supports JSX as an alternative way to describe UI. JSX is
transformed into calls to the DOM++ factory API
(document.createElement), so the resulting elements still use
the same DOM++ builders and real DOM nodes. No virtual DOM is introduced.
The example below shows the JSX source and the equivalent JavaScript
generated by a classic JSX transform. The pragma tells the transform to
use document.createElement as its factory.
JSX source
/** @jsx document.createElement */
const card = (
<article
className="card"
styles={{ color: "tomato", padding: "1rem" }}
>
<h2>Hello from JSX</h2>
<p>JSX syntax powered by DOM++ APIs.</p>
<button
type="button"
onClick={() => console.log("DOM++ + JSX")}
>
Explore
</button>
</article>
);
document.getElementById("app").setChildren(card);
Equivalent compiled JavaScript
const card = document.createElement(
"article",
{
className: "card",
styles: { color: "tomato", padding: "1rem" },
},
document.createElement("h2", null, "Hello from JSX"),
document.createElement(
"p",
null,
"JSX syntax powered by DOM++ APIs."
),
document.createElement(
"button",
{
type: "button",
onClick: () => console.log("DOM++ + JSX"),
},
"Explore"
)
);
document.getElementById("app").setChildren(card);
JSX is optional syntax and requires a JSX transform during development or build time. The compiled output runs on the DOM++ API; applications can also use the JavaScript API directly without JSX.
Chainable Setters on Real Nodes
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")
);
Components with Explicit Rerender
let count = 0;
const counter = document.createComponent((rerender) => (
document.createElement("section").setChildren(
document.createElement("strong").setText(count),
document.createElement("button")
.setText("Increment")
.setEvents({ click() { rerender(() => count++); } })
)
));
document.getElementById("app").setChildren(counter);
MVVM — State Separate from View
function createViewModel() {
let likes = 0;
const listeners = new Set();
return {
get likes() { return likes; },
like() {
likes++;
listeners.forEach((listener) => listener());
},
subscribe(listener) {
listeners.add(listener);
return () => listeners.delete(listener);
},
};
}
const vm = createViewModel();
const view = document.createComponent(() => (
document.createElement("div").setChildren(
document.createElement("strong").setText(vm.likes),
document.createElement("button")
.setText("Like")
.setEvents({ click() { vm.like(); } })
)
));
vm.subscribe(() => view.rerender());
document.getElementById("app").setChildren(view);
Fragments and Array Components
const items = document.createComponent((rerender) => (
document.createDocumentFragment(
document.createElement("strong").setText("Item A"),
document.createElement("strong").setText("Item B"),
showExtra
? document.createElement("strong").setText("Item C")
: null
)
));
const list = document.createComponent((rerender) => [
document.createElement("em").setText("X"),
document.createElement("em").setText("Y"),
]);
Safe by Default
// Rejected: inline events, srcdoc, style attribute, unsafe protocols
// document.createElement("button").setAttributes({ onClick: "alert(1)" });
// document.createElement("iframe").setAttributes({ srcdoc: "<script>..." });
// document.createElement("div").setAttributes({ style: "color:red" });
// document.createElement("a").setAttributes({ href: "javascript:alert(1)" });
// Use dedicated setters instead
const safe = document.createElement("a")
.setText("Safe link")
.setAttributes({ href: "https://example.com" })
.setStyles({ color: "blue" })
.setEvents({ click(event) { event.preventDefault(); } });
Explore
DOM++ — native-first, explicit, no virtual DOM. Use the JavaScript API directly, or write JSX and transform it to DOM++ factory calls.