
\documentclass[12pt]{article}
\usepackage[T2A,OT1]{fontenc}
\usepackage[default]{cantarell}
\usepackage[a4paper, top=20mm, bottom=20mm, left=20mm, right=20mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[russian, english]{babel}
\usepackage{tabu}
\usepackage{hyperref}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[normalem]{ulem}
\usepackage{float}
\floatstyle{boxed}
\restylefloat{figure}
\usepackage{setspace}
\onehalfspacing
\author{Artyom Bologov \href{mailto:falsehoods-html@aartaka.me}{(email)}}
\date{\today}
\title{Falsehoods Programmers Believe About HTML}
\makeatletter
\def\endenv{\expandafter\end\expandafter{\@currenvir}}
\makeatother
\begin{document}
\maketitle

Web is beautiful.
Web is ugly.
Web is astonishing.
A part of this appeal is HTML, with its historical quirks.
Many a programmer believe many things about HTML.
And some of the beliefs are not necessarily true.
So let’s explore some falsehoods programmers believe about HTML.

\section*{Language \& Parsing} \label{language}

\paragraph{HTML is just XML. All tags have matching closing tags.} \begin{quote}
Some tags (like \verb|<li>| or \verb|<p>|) have implicit closing tags:
\begin{figure}[h!]\begin{verbatim}
<li> List item without closing tag
<li> Another list item right after it
\end{verbatim}\caption{Example of implicit closing tags in \verb|<li>| tag}\end{figure}
\end{quote}

\paragraph{HTML is almost XML. All tags have closing tags, even if implicit} \begin{quote}
\verb|<img>| and \verb|<input>| are self-closing:
\begin{figure}[h!]\begin{verbatim}
<!-- Notice the / here!-->
<input type=text/>
\end{verbatim}\caption{Self-closing \verb|<input>| tag}\end{figure}
\end{quote}

\paragraph{Okay, okay, HTML is not XML. But all elements either have closing tags or self-close} \begin{quote}
\verb|<br>| and \verb|<hr>| don’t even need a self-close slash.

Actually, self-close slash
\href{https://jakearchibald.com/2023/against-self-closing-tags-in-html}{is mostly optional (and discouraged) in HTML},
so the difference is less pronounced.
\end{quote}

\section*{Standard} \label{standard}

\paragraph{HTML is defined by the standard} \begin{quote}
It’s defined by browser vendors and WHATWG (= browser vendors)
\end{quote}

\paragraph{The standard does not change after validation} \begin{quote}
The standard is "Living", and you can see (a very recent) date of last change at
\href{https://html.spec.whatwg.org}{Living Standard page}.
\end{quote}

\paragraph{The standard is self-contained (relating to HTML only)} \begin{quote}
HTML is also relating to a group of standards, including DOM and JavaScript.
In fact, many features of HTML are defined as JavaScript classes.
\end{quote}

\paragraph{There is only one (two? three?) doctypes for HTML documents} \begin{quote}
Oh my sweet summer child...
\begin{figure}[h!]\begin{verbatim}
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Level 1//EN">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Level 2//EN">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict//EN">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">
\end{verbatim}\caption{Many (not all) HTML doctypes}\end{figure}
\end{quote}

\section*{Practices} \label{practices}

\begin{itemize}\item All websites follow the standard.
\item No one uses HTML4.
\item No one uses HTML3 anymore.
\item No one uses HTML2 anymore.
\item No one uses HTML1 anymore.
\item No one uses tables for markup anymore.
\end{itemize}

\paragraph{No one uses XHTML} \begin{quote}
ePub, a widespread ebook format, uses XHTML for content markup. It sucks, but it’s a practice.
ePub 3.3 uses HTML5, but still.
\end{quote}

\section*{Runtime} \label{runtime}

\paragraph{Modifying DOM is slow} \begin{quote}
React propaganda is probably to blame for this illusion.
DOM is the most optimized data structure out there.
Whatever you put in it—it’ll sustain.
React will not.
\end{quote}

\paragraph{Browsers are just messy HTML parsers} \begin{quote}
Browsers are JS evaluators.
Browsers are layout engines.
Browsers are computer graphics toolkits (WebGL and fonts).
Browsers are OSes (they have file system interfaces, audio output, and many other APIs).
\href{https://polypane.app/blog/not-all-browser-apis-are-web-apis}{Browsers are interfaces to privacy-leaking ventor APIs}.
\end{quote}

\paragraph{SEO is hard and you need frameworks for it} \begin{quote}
Not really if you write simple semantic HTML.
Because it’s easy to parse and index, especially compared to JS-generated markup.
\end{quote}

\paragraph{WebAssembly will deprecate HTML and JS} \begin{quote}
These are different niches.
You can’t really make accessible websites with WebAssembly.
So if you want universal pages openable everywhere, you have to stick with HTML etc.
\end{quote}

\paragraph{HTML is not Turing-complete} \begin{quote}
\href{https://github.com/efoxepstein/stupid-machines}{It is, given CSS and user input}.
\end{quote}

\section*{Did I Forget Any?} \label{did-i-forget}

In case you haven’t found your favorite falsehood, feel free to suggest more!
This post will likely be on Reddit and Hacker News, so use comments there.
Or use the contacts from the
\href{run:about}{About page}!


\par\noindent\rule{\textwidth}{0.4pt}
\href{https://creativecommons.org/licenses/by/4.0}{CC-BY 4.0} 2022-2026 by Artyom Bologov (aartaka,)
\href{https://codeberg.org/aartaka/pages/commit/a91befa}{with one commit remixing Claude-generated code}.
Any and all opinions listed here are my own and not representative of my employers; future, past and present.
\end{document}
