View source

Peel this page back to read its live DOM

A canvas draws this whole page. Drag the turned corner at the top right towards the bottom left, or press the first button. Under the page is its DOM as it is now, written out as HTML, and nothing else. The text is written again when the page changes. A second page has the HTML as the server sent it under it.

The page is flat. Its top right corner is turned over.

DOM as texttext in a shadow root
This pagea child of the canvas
Canvasdraws the page through a shader
Handle
The four layers of this page, from the bottom.

The DOM now

Counted by a MutationObserver on the document since this page's script started. Changes to this table are left out of the counts, and the table stands still while the page is peeled back, so that it isn't itself a change in the text under the page.

Changes
0
To attributes
0
To text
0
To lists of children
0
Last change
none yet
Last written out under the page
not yet: it's written only while the page is peeled back

Change the page

Each block changes the DOM in one way. Peel the page and use a block: the lines that changed are marked, and the text scrolls to the first of them unless you have just scrolled it yourself.

A clock

Every second: one text node and the datetime attribute.

A counter

0

Each press: the data-count attribute and the text of an <output>.

A list

  1. Row 1, sent by the server
  2. Row 2, sent by the server

Elements are added, moved and removed.

A colour

One custom property in the style attribute of #sheet. The canvas draws the whole page again.

A <details> element

Open this

The browser adds the open attribute when the element opens and removes it when it closes.

One attribute, written by the browser.

A text field and a checkbox

Typing and ticking change properties. The attributes, and so the live DOM text, keep what the server sent until the button copies them.

Editable text

Change this sentence.

Each key press changes a text node.

A canvas inside the page

Drawn twice

A second drawable canvas, drawn into the picture of the first. Its button changes its own text.

Show the code the layers, the shader, the drag, and writing out the DOM as it changes
  1. The markup. The source text and the page share one box. The page carries fx="page-peel", so the fx library moves it into a canvas.
  2. The layout. The page scrolls inside a box one screen tall.
  3. Starting the page. Load the fx library and make the page peel.
  4. The shader. GLSL for WebGL and the same function in WGSL for WebGPU. Where the paper is gone it writes clear pixels.
  5. The same roll as outlines. Script needs to know where the paper is, for input.
  6. Splitting input along the roll. A clip-path on the canvas host, and two more on the handle.
  7. The drag.
  8. The DOM as text.
  9. Knowing when it changed.
  10. Writing it out again, at most four times a second.
  11. Replacing only the lines that changed.
  12. This page's part. Put the text under the page and the counts in the page.
  13. The blocks that change the page.
  14. The canvas inside the page.
  15. Counting frames on the device.
  16. Inside the fx library: the upload and the draw.

How it works

  • The document doesn't scroll. #sheet is a scrolling box as tall as the window below the menu bar, and it holds everything from the banner to the findings. The fx library wraps it in <fx-surface>, whose shadow root holds a canvas with content="drawable". The canvas is one screen in size whatever the length of the page.
  • The effect page-peel is one fragment shader. It gets the picture of the page and one point, the position of the paper's corner, from the CSS properties --fx-x and --fx-y. It rolls the paper round a cylinder that lies across the direction the corner has travelled, and draws the peeled paper mirrored and faded on top of the page. Where no paper is left it writes transparent pixels and a shadow.
  • The layer under the page is ordinary DOM below the canvas: a scrolling box of text lines with no controls. It's seen through the transparent pixels.
  • Transparent pixels still take input. A clip-path polygon on the canvas host, computed in script from the same numbers as the shader, cuts the canvas along the roll. Taps, scrolling and text selection beyond it go to the source text.
  • The paper lying on the page is pixels. The part of the page under it would take the tap. A handle element with the same outline lies over it and takes the drag instead. A round button on the paper's corner does the same job for a keyboard: Enter peels the page and puts it back, Escape puts it back.
  • "Take the page off" rolls the page into the bottom left corner. The roll stays there to be pressed, because the layer under the page has no button of its own.
  • The text is document.documentElement.getHTML() with the shadow root of the canvas host passed in, so the canvas that draws the page is in it. It's written again at most four times a second while a MutationObserver reports changes and the page is peeled back.
  • Lines that are equal at the start and at the end of the old and new text keep their elements. The lines between are replaced and marked for a moment.
  • The text lines are built in a shadow root that isn't passed to getHTML(). So the text doesn't contain itself, and the observer on the document isn't told about its updates.

Live checks

Each check builds its own fixture in a corner of the window. The page isn't peeled or changed by them.

ResultExperimentDetail

Findings

From Chromium 157 with software rendering, 412 px wide, on 2026-11-22. The rows above say what your browser does.

On this device: move the paper and scroll the page, and the number of frames the canvas drew is written here.

  • Works: one canvas draws a whole scrolling page. The page is a scrolling box inside the canvas. Scrolling it by touch, by wheel and from script raises a new frame, and elements are found at their scrolled positions. At 412 px wide and scale 2.625 the canvas is 2.24 megapixels, whatever the length of the page.
  • Works: a clip-path on the canvas host splits input along the roll. A shader can make pixels transparent but the element behind them still takes the tap. With the host clipped, elementFromPoint() gives the layer under the page, and a touch swipe there scrolls the source and not the page.
  • Works: the text is the page as it is. It contains <fx-surface>, its canvas with content="drawable", the menu that a script built, and the --fx-x and --fx-y values, which change while the paper is dragged.
  • Limit: the text is attributes and text, not state. A typed value, a ticked checkbox, a scroll position and the pixels of a canvas aren't in it. outerHTML also leaves out every shadow root. getHTML({ shadowRoots }) writes the ones it is given.
  • As built: setting textContent is reported as a change to the list of children. The clock replaces its text node each second, so the count of changes "to text" stays at 0 until the editable sentence is typed in.
  • As built: a view of the DOM that is in the DOM would show itself. The text is in a shadow root, which getHTML() skips unless asked and which a MutationObserver on the document doesn't report. The table of counts is in the page, so the observer leaves its changes out by hand.
  • Not verified here: the WebGPU route on a screen, and how many frames a second a phone draws while the paper is dragged and while the page scrolls. The line above this list reports both on the device that opens the page. Also open on a phone: text selection handles in the source text, and the on-screen keyboard over a document that doesn't scroll.