Bruce Perens via Dng said on Sat, 4 Jan 2025 11:37:42 -0800
>My understanding is that there is a difference between HTML5 and
>XHTML5,
Technically I'm not using XHTML5 because I have no mime type statement.
I use only <!doctype html> at the top. The HTML5 spec allows, but
doesn't require, ending tags and trailing slashes necessary to make
your HTML5 also conform to the XML syntax (well formed).
>and that HTML5 does not have to be well-formed XML.
Yes!
>You can
>use XHTML5 at the expense of omitting <noscript>, which has the effect
>of making its content a no-op when scripts are enabled, thus it isn't
>well-formed.
I briefly cruised the Internet and found that a small majority of
people consider <noscript> to be suboptimal and replaceable by better
alternatives. A significant minority valued <noscript>, but opinions
weren't strong either way.
>It seems to me that using XHTML5 would only be for pedantic reasons or
>if you have some reason to parse it with an XML parser rather than an
>HTML5 parser.
The major reason to build your HTML5 page as well formed XML is that it
makes it much easier for you, the author, to:
1) Create valid HTML5, thus almost-identical presentation on all
competent browsers.
2) Make your HTML5 conform to what you really want.
3) Not have to learn every one of the nitty gritty rules of HTML5 just
to make a valid HTML5 page. Like I said very early in this thread,
XMLizing your HTML is the equivalent of using extra parentheses in
programming or math so you don't have to remember every rule of
precedence.
4) Once you make it a personal requirement to make your HTML5 well
formed XML, you can early and often run xmlchecker.py, which takes
0.03 seconds on my machine. A well formed XML HTML5 page has very few
HTML5 validation problems, and those validation problems are
extremely easy to diagnose and fix.
5) Once you make it a personal requirement to make your HTML well
formed XML, you can use the div.diagnostic trick to reduce debugging
time by 60% or more.
6) End tags make it much easier to quickly visualize the hierarchy of
the HTML5 code.
In other words, neither the browser nor the machine cares whether it's
well formed XML. Only the human author cares, and well formed XML makes
the human author's task much less brain taxing, so the author can use
more brainpower on authoring the content.
About the XML parser thing: HTML5 that's also well formed XML makes a
pretty darn good "write once, read everywhere" format.
About the pedantic thing, I'd say it's more pedantic *not* to use end
tags, because end tags make life much easier for a human author. Let's
review the definition of "pedantic" on dictionary.com:
1. ostentatious in one's learning.
2. overly concerned with minute details or formalisms, especially in
teaching.
Taking the second definition first, the author making HTML5 also well
formed needn't memorize the minute details for formalisms of the HTML5
specification in order to achieve the same result. XMLized HTML5 is
more practical.
About the first definition, we need to get a definition for
ostentatious:
1) characterized by or given to pretentious or conspicuous show in an
attempt to impress others: an ostentatious dresser.
2) (of actions, manner, qualities exhibited, etc.) intended to attract
notice: Lady Bountiful's ostentatious charity.
As far as #1, there are two types of authors foregoing end tags and
trailing slashes:
1) Authors producing non-valid HTML. These guys don't have an
ostentatious bone in their body; they're just quick and dirty corner
cutters who don't give a flying flamingo about standards or about
uniform presentation on various browsers.
2) Authors producing valid HTML. These guys are ostentatious. "Hey, look
at me, I created valid HTML5 without using end tags because I know
every last minute detail of the HTML5 so I don't need those training
wheels called end tags and trailing slashes!"
In summary, my viewpoint is that in a practical world, making your
HTML5 well formed XML is salt-of-the-earth, whereas non XML HTML5 is
either pedantic or careless, depending on whether the result is valid
HTML5 or not, respectively.
>Browsers parse with intent to accept all sorts of
>poorly-formed stylings,
Exactly! Every validity error is an undefined behavior that different
browsers treat differently.
SteveT
Steve Litt
http://444domains.com