Hacker News new | ask | show | jobs
by robgibbons 1468 days ago
Sure, but the author is advocating that you compose HTML this way. It would quickly become a mess of nested elements with zero visual indication of hierarchy.

The DOM is a tree, with nested elements. Losing that information doesn't get you anything but tag soup (which is, oddly, what the author suggests this style is supposed to avoid)

4 comments

First and foremost, the author advocates for organising documents in a much flatter DOM tree. In this style all major page elements sit at the same hierarchical level, so there is no "mess of nested elements", the is no need for visual indication of hierarchy if there is no hierarchy to begin with.

I think that is a very compelling format for a text-first web page, like a blog post or news article. Of course it is a coding style not well suited for complex web apps with deep hierarchy.

One interesting detail is that a lack of deep nesting was in fact a deliberate design goal for HTML originally, to make WYSIWYG editing more feasible.

http://info.cern.ch/hypertext/WWW/MarkUp/HTMLConstraints.htm...

In a tree you have branches off branches off branches etc.

You can’t orient yourself - you can’t tell where you are - unless you count the branches. And indenting makes that visible.

In the examples for TFA, you can tell your location from the names of the elements. Eg <td> is enough for you to know you’re probably inside a tr inside a table.

And that is the more common case than the general tree example.

But a method of describing html does have to answer the question of how it represents arbitrarily deep nesting. But I like the answers it’s given for the more common case of structures that are not arbitrarily deep.

What’s a TFA?
The Fine(or Fucking) Article
I always read the 'F' as "Featured"
Urbandictionary agrees. I reprogrammed myself to read it as "Fabulous" using a text replacement addon.
And this terminology (TFA) comes from at least the Slashdot days, about 20 years ago.
In turn, probably descended from “RTFM”—on Slashdot people who commented despite obviously not having read the article were told to “RTFA,” which eventually led to “TFA” as a general term to refer to the original article.
The "F" has always been "Forementioned" for me.
The problem is that HTML has multiple uses. The author is describing the case of authoring content, with HTML used as a markup language. However a lot of websites and web applications use HTML more like a layout and templating engine for a GUI framework.
Only if the formatter is unaware of HTML. If it can't handle automatically closing <p> tags, then it's unaware and is trying to treat HTML like XML.

Or, to put another way, HTML != DOM, even though HTML can be rendered into a DOM.