i guess follow me @bethposting on bsky or pillowfort


discord username:
bethposting

rem
@rem

when handcoding my website i very specifically went and put terminating slashes on all the self-closing tags and then a week later read it's actively discouraged to do that and very specifically went and took them all back out. html is SO cool. it's like all the sludge and weird technical debt of the rest of tech, but objectively so much less evil


bethposting
@bethposting

oh damn i gotta go edit some posts

(jk eh it's not worth it but good to know for the future)


bethposting
@bethposting

i also just learned about this today. stack overflow sez apparently most modern parsers will just strip out the slash and it ends up being just <br> underlyingly no matter which one you write, so i guess there's no real reason to put it unless you want your stuff to work with old browsers



You must log in to comment.

in reply to @rem's post:

absolutely! to be clear they're not invalid html, the slashes are just ignored by compliant html parsers, but therefore are prone to break buggy parsers

terminating slashes on self-closing tag have never been part of HTML per se. HTML 5 parser ignores them as a compatibility hack for (vast majority of) XHTML pages, probably so that a user agent doesn't need to implement two similar-but-incompatible parsers

(specifically, XML has no concept of a self-closing tag, so all such tags were converted to an opening-closing pair. in XHTML <tag/> is just shorthand for <tag></tag>, whereas in HTML 5 <tag/> is equivalent to <tag>. this does mean in XHTML you could do stuff like <div/> to create an empty div which would no longer work in HTML 5, but I guess it was rare enough they did not care to add further corner cases)

in reply to @bethposting's post:

  1. causes problems if you need xml compatibility (99% of people should pick this one)
  2. causes problems
  3. causes problems if you don't need xml compatibility