News for hackers. Stuff that matters.
Re:Write HTML Right by egeozcan on Friday June 10, 2022 @11:23AM (#31695440)
> Indentation _is_ information, which is lost here.

Isn't it a "view" of information? Any sufficiently advanced text editor can recreate it with a simple key combination.

Re:Write HTML Right by robgibbons on Friday June 10, 2022 @11:27AM (#31695508)
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)

Re:Write HTML Right by SkeuomorphicBee on Friday June 10, 2022 @02:32PM (#31697764)
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.

Re:Write HTML Right by niconii on Friday June 10, 2022 @04:02PM (#31698775)
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...

Re:Write HTML Right by LeonB on Friday June 10, 2022 @11:48AM (#31695796)
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.

Re:Write HTML Right by Jcowell on Friday June 10, 2022 @11:51AM (#31695837)
What’s a TFA?
Re:Write HTML Right by dec0dedab0de on Friday June 10, 2022 @11:58AM (#31695938)
The Fine(or Fucking) Article
Re:Write HTML Right by shkkmo on Friday June 10, 2022 @01:41PM (#31697185)
I always read the 'F' as "Featured"
Re:Write HTML Right by LinuxBender on Friday June 10, 2022 @03:22PM (#31698371)
Urbandictionary agrees. I reprogrammed myself to read it as "Fabulous" using a text replacement addon.
Re:Write HTML Right by nayuki on Friday June 10, 2022 @02:50PM (#31697985)
And this terminology (TFA) comes from at least the Slashdot days, about 20 years ago.
Re:Write HTML Right by anjbe on Friday June 10, 2022 @03:06PM (#31698175)
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.
Re:Write HTML Right by mlok on Friday June 10, 2022 @05:19PM (#31699487)
The "F" has always been "Forementioned" for me.
Re:Write HTML Right by nerdponx on Friday June 10, 2022 @11:38AM (#31695660)
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.
Re:Write HTML Right by falcolas on Friday June 10, 2022 @11:39AM (#31695673)
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.

Re:Write HTML Right by Something1234 on Friday June 10, 2022 @11:29AM (#31695530)
Sometimes I indent in a way that my text editor doesn't exactly understand to better state where complex expressions begin and end.
Re:Write HTML Right by jahewson on Friday June 10, 2022 @11:29AM (#31695521)
I don’t think the author means the information-theory kind of information. I could gzip the file without a loss in that kind of information.