Re: An HTML Announcement of perl-5.12.0 on The Perl Foundation Blog

[email protected] (Mark Mielke) Mon, 26 Apr 2010 06:09:40 -0400
Newsgroups perl.advocacy,perl.perl5.porters
Message-ID <[email protected]>
Interesting on exactly why "<hr />" shows up as invalid in validators. 
Apparently I and most browser writes never learned about the SGML short 
tag capability. Perhaps, because we always thought of HTML as something 
that was *like* SGML, but definitely not actual SGML. :-)

I think it is a bit odd to have the validator implement different rules 
than common browsers. Not sure which is wrong or how to fix this...

I think I'll still use <hr />, as it works as intended. It is valid 
XHTML, which means it works in new browsers with the right headers, and 
it is valid HTML in old browsers (whether they are spec compliant or not).

Thanks for the reference though - it was worth the read.

Cheers,
mark

On 04/26/2010 04:13 AM, Philip Potter wrote:
> On 25 April 2010 22:53, Mark Mielke<[email protected]>  wrote:
>    
>> On 04/25/2010 04:44 PM, Eric Brine wrote:
>>      
>>>     The combined open close tags such as<hr/>  should be used with a
>>>     space before the / to make sure it works on old and new browsers.
>>>
>>>     Try:<hr />
>>>
>>>
>>> That's not valid HTML.
>>>        
>> What is invalid about it? The "/" gets interpretted as an unrecognized
>> attribute. Do you mean formal HTML without support for extensions via new
>> attributes? Which HTML or XHTML parsers do you know that will break with<hr
>> />?
>>      
> Does the w3 validator count?
> The HTML strict validator treats<hr />  as an error:
> http://validator.w3.org/check?uri=http%3A%2F%2Fwww.doc.ic.ac.uk%2F~pgp%2Fwrong-s.html
> The HTML transitional validator throws up a warning for<hr />:
> http://validator.w3.org/check?uri=http%3A%2F%2Fwww.doc.ic.ac.uk%2F~pgp%2Fwrong-t.html
>
> The reason is explained here:
> http://www.cs.tut.fi/~jkorpela/html/empty.html
>
> tl;dr version:<hr />  in HTML means<hr>>  -- that is, an<hr>  tag
> followed by a greater-than sign. Almost no browser displays it this
> way; but HTML validators *do* interpret it this way. If anything,
> using<hr/>  to mean<hr>  is a nonstandard but common extension. I'm
> not sure if<hr/>  will induce quirks mode in browsers.
>
> Phil
>
>