News for hackers. Stuff that matters.
Re:Modern Javascript: Everything you missed over the last 10... by randompwd on Sunday May 16, 2021 @07:40AM (#27172970)
> None of those are needed for proper HTML; they're implicit.

They are needed for proper HTML. They're just not needed for HTML.

Re:Modern Javascript: Everything you missed over the last 10... by chrismorgan on Monday May 17, 2021 @03:30AM (#27180872)
They are not needed for proper HTML. <html>, <head> and <body> are all defined as having optional start tags and end tags. It’s perfectly valid and reasonable to skip their start tags if you’re not putting any attributes on them. (I always skip <head> and <body>, but never skip <html> because I always have a lang attribute on it, and sometimes more, such as a class attribute. But I definitely still skip its end tag.)

There’s plenty of precedent for habitually skipping start tags in the HTML syntax. Few people write <tbody> if they are doing a simple table with no <thead>, because <tbody>’s start and end tags are both optional. <html>, <head> and <body> are the same.

(I’m spelling out “in the HTML syntax” here, because if you’re using the XML syntax—not common, but not unknown—no start or end tags are optional; if you write <table><tr>…</tr></table> in an XML syntax HTML document, you will get an invalid HTML document that lacks the <tbody> element.)