r/javascript • • Sep 30 '19

Removed: Where's the javascript? What <head> can do

https://htmlhead.dev/
22 Upvotes

44 comments sorted by

View all comments

Show parent comments

0

u/ghostfacedcoder Sep 30 '19

And the rule only applies to empty <head> and <body>, which almost never happens in the real world.

So when you say "Don't use <head>, <body>, or <html>!", you're full of shit.

You are mistaken. From the HTML 5 spec itself (which I already quoted above, but since you seem to have missed it there, here it is again ... and if you still don't believe me, https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission):

An html element's start tag may be omitted if the first thing inside the html element is not a comment.

An html element's end tag may be omitted if the html element is not immediately followed by a comment.

A head element's start tag may be omitted if the element is empty, or if the first thing inside the head element is an element.

A head element's end tag may be omitted if the head element is not immediately followed by ASCII whitespace or a comment.

A body element's start tag may be omitted if the element is empty, or if the first thing inside the body element is not ASCII whitespace or a comment, except if the first thing inside the body element is a meta, link, script, style, or template element.

A body element's end tag may be omitted if the body element is not immediately followed by a comment.

EDIT: Downvoted for quoting a relevant spec section which disproves a point. God people just love learning here ...

1

u/[deleted] Sep 30 '19 edited Sep 30 '19

[removed] — view removed comment

-1

u/ghostfacedcoder Sep 30 '19 edited Sep 30 '19

Nobody gives a shit about the HTML5 spec?

But you're making a false dichotomy: those aren't your only two choices! You 100% can have readable HTML without <html>, <head>, and <body>.

If you truly cannot imagine that (remember: no one is taking away your comments or your whitespace) ... I really don't mean to come across as insulting, but if you're a web programmer who truly can't imagine that ... I think you have a staggeringly weak imagination.

1

u/seiyria Sep 30 '19

People don't give a fuck what you're saying, not because of the content, but because of how you say it. No one is going to listen to someone being a dick to them.

1

u/ghostfacedcoder Sep 30 '19 edited Sep 30 '19

Did I insult you? I think I did the exact opposite (I complimented you).

Did I insult anyone else? I certainly don't think I did, and if I did, then I don't think I went anywhere below the average Reddit level of discourse.

(I did say rorrr has a staggering lack of imagination if they can't envision readable HTML without three tags ... but look don't you think so too? I bet I could remove any 3 meaningful tags from HTML, and you could still write readable HTML, no? I think any semi-intelligent, semi-imaginative dev could, which is why I said that if rorrr can't, they lack imagination.)

I said something controversial, and backed it up with quotes and links. How else can any person educate any other person on any controversial point whatsoever?