This page is written in Fixed-Point HTML. When the HTML
is parsed and then re-serialized by a browser, it is identical to the
original source code. In other words, it is a
"Fixed
Point" in the browser's parse-serialize functionality. The source is
invariant, no matter how many round-trips it makes through
outerHTML, it will always be the same.
How to test Fixed-Point HTML
Fixed-Point HTML can be checked on the fly in the browser. Simply compare the page's source code against the serialized document's HTML (plus doctype). I.e., the following expressions will always be true for Fixed-Point HTML (before DOM modification):
await (await fetch(document.location.href)).text()
===
'<!DOCTYPE html>\n'+document.documentElement.outerHTML
Press the button to check the page. View source to see the code.
How is Fixed-Point HTML different?
For the most part Fixed-Point HTML is the same as typical text-book HTML. However the syntax is very regimented. Some highlights:
- No spacing is allowed between
htmlandhead/bodyelements - Reserved Characters must always be escaped with character entities (e.g. > is
>) - All elements must be explicitly closed (no skipping
</p>) - XML-flavored self-closing elements are banished (use
<br>instead of<br />) - Element Attributes are separated by single spaces and must always have a double-quoted value
(use
<img src="a.jpg" alt="">instead of<img src = 'a.jpg' alt >)
Why write Fixed-Point HTML?
I could claim that Fixed-Point HTML is an aid to writing consistent and error-free HTML (which it can be), but the real reason to code in Fixed-Point HTML is simply the satisfaction of knowing that you and the browser are in total agreement about the HTML.