32 — Layout: the fault that exists only after a browser has made it

After this lesson you will be able to say why does this page overflow is not a question about the page; name the inputs a visual fault is a function of and say how many of them anybody in Loom owns; explain why the one check in this repository that catches a visual defect without a person looking at a picture goes blind in a loom.backdrop, and why the backdrop is right and the check is right; state where the line falls between the half of an instrument that needs a laid-out page and the half that is arithmetic, and give the two exclusions that can live on each side of it; say why scrollWidth is the obvious reading and wrong twice over, with the two features it reports as defects; explain why a measurement that had never been taken was deliberately kept out of the exit code in the change that first took it; and — the part this lesson found by running rather than by reading — say which of the functions this harness hands to a browser a test in this repository can run, and what decides that.

Prerequisites: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31.

Lesson 31 ended on a question: what is the last moment at which this is still visible, and is anything checking it there? For a behaviour the answer was registration, because a behaviour leaves no trace in a pure function of the tree and registration is the last place anything that is not a browser can see it.

This seam answers the same question and the answer comes out backwards. There is no earlier moment to lose. A heading whose longest word paints past the edge of a phone is not in the tree, not in the registry, not in a declaration, and not in the markup — it does not exist yet. It comes into being when a layout engine is handed that markup, a viewport width, and whichever font actually loaded, and it stops existing again when the reader turns the phone sideways.

So the last moment at which it is visible is also the first, and nothing that runs before it could have caught it however far it reached. That makes the remedy the sixth one Part V has used: not reach further, not manufacture a second copy, not instrument a place in the code, not ask an author, not close a set — stand where the fact is and measure it. Which sounds like the end of the problem and is the beginning of it, because the moment your checker is a measurement rather than a comparison, the hard question stops being can I see it and becomes which of the things I can see are defects.

Reading what you have done so far…