in reply to Re: For valid HTML
in thread For valid HTML

Either way, the trailing slash will probably be at least optional.

At most optional. The slash being treated as optional is the best possible result, not the worst. The possible outcomes range from "incorrectly used and ignored" to "incorrectly used and gives an error". (Browsers don't support the correct use.) The OP's browser is apparently somewhere in the middle of that range since it ignores the error for rendering purposes while discretely notifying the user of the error ("red circle with an X in it").

especially with a doctype of 4.0 transitional that tells us to expect a jumble of tag soup

It sounds like you're saying transitional documents don't have to be well-formed, and that's not true.

Replies are listed 'Best First'.
Re^3: For valid HTML
by JavaFan (Canon) on Apr 05, 2010 at 20:59 UTC
    Actually, <BR/> would be the start of a SHORTTAG construct (ending with the next slash). It's not supported by most mainstream browser, but it's a valid SGML construct, and the HTML DTD doesn't prohibit it (unfortunally). See SGML features with limited support.

      Actually, <BR/> would be the start of a SHORTTAG construct (ending with the next slash).

      "Actually"? Not only do I know that, I covered that case. ("Browsers don't support the correct use.")

      but it's a valid SGML construct, and the HTML DTD doesn't prohibit it (unfortunally)

      Not quite. BR can't have a body. <BR// might be valid HTML, but <BR/<.../ is not.

Re^3: For valid HTML
by rowdog (Curate) on Apr 06, 2010 at 04:40 UTC
    The slash being treated as optional is the best possible result, not the worst.

    That's a matter of opinion, I'm sure some people would rather see XHTML win out over HTML 5.

    It sounds like you're saying transitional documents don't have to be well-formed, and that's not true.

    Oh really? The front page of perlmonks renders just fine in my browser but it's not even close to a well-formed document. To clarify, I believe there are two ends of the spectrum: what works and what is correct. Many websites work just fine with broken HTML. Many times, the HTML is intentionally broken to support browsers that don't support standards. I really don't mean to criticize perlmonks here, it works and that's all I ask, but the site doesn't exactly validate.

    Myself, I strive to write correct code in any language and to comply with any applicable standards to the best of my ability.

      That's a matter of opinion

      No opinion. It really is illegal HTML, and that working to not working is the range of behaviour.

      Ok, I suppose saying having it work is the best behaviour is an opinion. But seriously? You'd say browsers throwing errors at the slash would be better? For whom??

      I'm sure some people would rather see XHTML win out over HTML 5.

      That makes no sense. They're orthogonal. HTML 5 has an XML serialization too.

      Oh really? The front page of perlmonks renders just fine in my browser but it's not even close to a well-formed document

      I was expecting a counter example after "Oh really?". You need to show that the page wouldn't be rendered fine if the strict DTD was specified to contradict me. Browsers expect a tag soup for HTML docs no matter what DTD (if any) is specified.

      To clarify, I believe there are two ends of the spectrum: what works and what is correct.

      Earlier you were disagreeing with my opinion that having bad HTML work anyway is the best behaviour. Now you agree with it. What are you trying to say?

        HTML 5 has an XML serialization too.

        Thanks for the heads up. I was suffering from the illusion that XHTML and HTML5 were competing standards.

        Earlier you were disagreeing with my opinion that having bad HTML work anyway is the best behaviour. Now you agree with it. What are you trying to say?

        Writing this post I realized that I have conflicting opinions and that I may not have expressed my beliefs clearly.

        1. I believe that, in the real world, browsers should try to make broken HTML work anyhow.
        2. I believe that, in a "perfect web", all browsers should refuse to show broken documents which would force dog+world to comply with the standards.

        I guess I just got too many phone calls saying "it's broken on IE4 on mac" (of course it is) sigh. Not to mention the countless "best viewed with intentional broken for IE" pages. But hey, that's the price I've paid for using Linux on the desktop since 1995.

        PS: My original point to Lady Aleena was that the slash didn't matter for two reasons: 1) We live in the real world where broken HTML works and 2) The future standards are currently saying that the slash will become valid.