Testing headings
Which of the headings below are programmatically identifiable as heading elements?
Gandalf
A wise, wandering guide whose true power lies not in force but in inspiring courage, restraint, and moral clarity in others. He is Middle-earth’s quiet centre of resistance, always nudging events toward hope.
Bilbo Baggins
A reluctant adventurer who discovers that comfort and curiosity can coexist. Beneath his homely manners is a surprising well of nerve, humour, and decency that reshapes the fate of the world without him ever seeking glory.
Frodo Baggins
Sensitive, introspective, and burdened by a task far larger than himself, Frodo represents moral endurance. His strength is spiritual rather than physical: compassion, resilience, and the willingness to suffer so others may live free.
Samwise Gamgee
Loyalty made flesh. Sam is bravery without ego, love without demand, and perseverance without complaint. His grounded goodness is the emotional engine that carries Frodo—and the quest—when all other hope fails.
Saruman
Once wise and noble, he becomes the embodiment of corrupted intellect: a mind convinced that control is the only path to peace. His fall is a cautionary tale about brilliance severed from humility.
Gollum
A tragic figure consumed by obsession and self-loathing, yet still carrying shards of the person he once was. He is the shadow side of desire—a mirror of Frodo—revealing how easily love of the Ring rots identity from the inside.
There could be an empty heading around here somewhere!
Did you find it?
A heading can be empty of text but not empty of meaning, if all it contains is a well-labelled image.
The heading above has no text content at all, but it does have an accessible name, "Acme Corp", from the image's alt. This one should not be treated as empty.
This heading also contains only an image, but the alt is empty, so unlike the one above, there's genuinely no accessible name here. This one should stay flagged as empty.
A heading nobody can see
There's a heading directly above this paragraph that's hidden with display: none. It's not the first heading on the page, so it's a useful check that anything flagging it renders in the right place, next to where the heading actually is, rather than floating to the top of the page.