---
title: "Building SVG in Lightpanda"
description: "Browser features are easier to review when their foundations are clear. Seven linked contributions build Lightpanda's SVG support from values to browser access."
url: https://mh0pe.github.io/blog/typed-svg-dom/
author: "Madison Hope Steiner"
published: 2026-10-08
modified: 2026-10-08
---

[← All writing](https://mh0pe.github.io/blog/)

# Build a browser capability in layers.

**A radius that stays attached** Change the radius attribute from 12 to 24 and the same live SVG value reflects 24. The circles illustrate that relationship in the document model, not a browser rendering result.

How seven dependency-ordered contributions brought a typed SVG document model into Lightpanda.

[Lightpanda: SVG prototype foundations](https://github.com/lightpanda-io/browser/pull/3012)

By [Madison Hope Steiner](https://mh0pe.github.io/about/)

Lightpanda Browser engineering

**In this article**

Seven layers of the SVG model

At a glance

A capability is easier to review when each layer establishes the contract the next one needs.

A browser's graphics support is not just about whether an element exists on a page. Programs also need to identify its type, read and change its values, work with collections, ask geometry questions, and inspect text. Those behaviors form a platform contract that other software builds on.

For Lightpanda, I reworked a broad SVG prototype into seven dependency-ordered contributions. The stack moves from prototype inheritance through live values, collections, geometry, structural elements, resources, and text. All seven layers were merged. The useful story is how those layers made a substantial capability reviewable.

## Make the foundation extensible.

The first layer derives SVG prototype chains at compile time. That foundation gives graphics and geometry elements the expected inheritance path without building another fixed-depth factory for every new interface. Identity matters because programs use inherited methods and type checks to decide how to interact with an element.

Seven plates assemble beneath the letter A. The first three foundations are highlighted: prototypes, live values and collections.

**Build beneath the picture.**

Seven layers of SVG document-model work. This is an anatomy, not a rendering demonstration.

**Diagram key**

**Prototypes**
Identity and inheritance.

**Live values**
Attribute-linked values.

**Collections**
Live lists.

**Geometry**
Paths, lengths, points and bounds.

**Structure**
Document organization.

**Resources**
Reusable graphics.

**Text metrics**
Fallback measurements.

- [Lightpanda: SVG prototype foundations](https://github.com/lightpanda-io/browser/pull/3012)
- [Lightpanda: live scalar values](https://github.com/lightpanda-io/browser/pull/3034)
- [Lightpanda: live collections](https://github.com/lightpanda-io/browser/pull/3030)

Live values and collections then build on that identity. Their behavior needs to remain connected to the element rather than becoming a detached copy of its current attributes. Treating those contracts as their own layers gave review and testing a smaller, more coherent unit of work.

**A layer establishes a contract for the next.**

1. Element identity
2. Live attribute behavior
3. Higher-level geometry and text

The later APIs rely on the meaning established below them, not just on a shared file layout.

The next layer is resources. I asked on LinkedIn [why SVG resources are often harder to model than the shapes they style](https://www.linkedin.com/feed/update/urn:li:activity:7505709576437043200/).

## Keep geometry and text precise about what they provide.

The geometry work adds path parsing, length and point queries, and analytic fill bounds. Structural and resource elements extend the document model around that behavior. Each piece can be discussed in terms of a concrete API contract rather than a broad claim that graphics support is complete.

The plates spread apart but remain one document model. A curved connector joins the illustrated attribute to its live value.

**A value belongs to a living model.**

Geometry and text build on typed values, attributes and collections with specific limits.

**Same object** ** New live behavior**

In the illustration, the radius changes from 12 to 24 through a live value linked to its attribute. Shape geometry and fallback text metrics are separate capabilities; neither is a complete renderer.

**Diagram key**

**Second marker and curved connector: Live values**
Values stay attached to their attributes.

**Third marker: Collections**
Lists stay connected to the document.

**Middle marker: Geometry**
Paths, lengths, points and bounds build on those foundations.

- [Lightpanda: analytic geometry and paths](https://github.com/lightpanda-io/browser/pull/3033)
- [Lightpanda: structural elements](https://github.com/lightpanda-io/browser/pull/3031)
- [Lightpanda: resource elements](https://github.com/lightpanda-io/browser/pull/3029)
- [Lightpanda: text DOM and fallback metrics](https://github.com/lightpanda-io/browser/pull/3032)

The text layer provides typed elements and isolated deterministic fallback metrics without introducing a new font-shaping dependency. That boundary is deliberate. Fallback measurements are useful within their documented role; they are not interchangeable with a complete shaping and rendering stack.

## Use the delivery shape to improve the design.

Splitting a broad change is valuable when the split follows dependency meaning. A foundation can be reviewed and merged before the behavior that depends on it. Reviewers can ask whether a layer is internally sound and whether its contract is sufficient for the next layer, instead of holding the entire capability in their heads at once.

The seven plates align again. Two separate measurement capabilities stay visible beside the letter.

**Keep the capabilities distinct.**

Geometry and fallback text metrics are specific capabilities, not a full browser renderer.

**Diagram key**

**Dashed outline attached to a letter plate: Geometry**
The bounds of the illustrated letter, not a claim about a full renderer.

**Separate lower-right strip: Text metrics**
Fallback text measurements, not a complete rendering system.

- [Lightpanda: analytic geometry and paths](https://github.com/lightpanda-io/browser/pull/3033)
- [Lightpanda: text DOM and fallback metrics](https://github.com/lightpanda-io/browser/pull/3032)

I use that approach when a system change spans several kinds of reasoning. It does not make the underlying work small. It makes the path through the work legible, and it gives a team useful checkpoints where they can refine the design without losing the overall direction.

I also wrote about the delivery shape itself, asking whether [a pull request stack can double as an architectural drawing](https://www.linkedin.com/feed/update/urn:li:activity:7502772825108148224/).

**For a closer technical look**

- The layers are logically ordered: prototypes, scalars, collections, geometry, structure, resources, and text.
- The geometry and text reviews document their repository and relevant Web Platform Test checks, including the scope of the fallback text backend.
- Typed DOM behavior and analytic measurements are different responsibilities from painting a complete page.

## What I take from it

Build and review SVG support in dependency order, keeping geometry, text metrics, and browser access as distinct responsibilities.

## Code and further reading

- [Lightpanda: SVG prototype foundations](https://github.com/lightpanda-io/browser/pull/3012)
- [Lightpanda: live scalar values](https://github.com/lightpanda-io/browser/pull/3034)
- [Lightpanda: live collections](https://github.com/lightpanda-io/browser/pull/3030)
- [Lightpanda: analytic geometry and paths](https://github.com/lightpanda-io/browser/pull/3033)
- [Lightpanda: structural elements](https://github.com/lightpanda-io/browser/pull/3031)
- [Lightpanda: resource elements](https://github.com/lightpanda-io/browser/pull/3029)
- [Lightpanda: text DOM and fallback metrics](https://github.com/lightpanda-io/browser/pull/3032)

[Join the conversation about SVG foundations on LinkedIn](https://www.linkedin.com/posts/madisonhsteiner_webapi-derive-svg-prototype-chains-by-mh0pe-activity-7498223977895559168-vUST)

Covers work from July 2026 Posted October 8, 2026

Also on

- On DEV from Dec 9
- [Hashnode](https://mh0pe.hashnode.dev/typed-svg-dom)
- In editorial review at HackerNoon
- On daily.dev from Dec 9

- [SVG](https://mh0pe.github.io/blog/?tag=SVG#topic-browser)
- [Platform contracts](https://mh0pe.github.io/blog/?tag=Platform%20contracts#topic-browser)
- [Incremental delivery](https://mh0pe.github.io/blog/?tag=Incremental%20delivery#topic-browser)

[See what the seven SVG layers added to Lightpanda](https://mh0pe.github.io/capabilities/#capability-lightpanda-svg)

## Read next.

AI workflows

### [Useful agent tools need clear boundaries.](https://mh0pe.github.io/blog/aws-labs-mcp/)

Documents, images, transports, and browser sessions in my AWS Labs MCP contributions.
