Re: Slash or no slash?

2015-03-05, 15:21, David Dorward wrote:

> On 3 Mar 2015, at 14:20, Bill Byrd wrote:
>
>     Immediately below your snippet for the “passed the validation”
>     badge, you have this...
>
>     (close the img tag with > instead of /> if using HTML <= 4.01)
>
>     To me, that suggests that HTML5 user WOULD use the forward slash.
>     That’s not correct is it?
>
> It is correct. The |/| character is optional in HTML 5.

No, it is optional only in HTML serialization; in XHTML serialization, 
you need to use either <img .../> or <img ...></img>.

> See Stackoverflow: Are self-closing tags valid in HTML5?
> <http://stackoverflow.com/questions/3558119/are-self-closing-tags-valid-in-html5>

So much confusion... after years of improving the answers there, the 
approved answer is still wrong in this respect: it does not recognize 
that HTML5 comes with two syntaxes.

The instructions are confusing, but not formally incorrect. They give 
instructions for XHTML, then give instructions for non-XHTML HTML, but 
express this in an odd way. They apparently reflect ideas of the time 
when XHTML was fashionable and was regarded as the modern HTML,

It would be simpler to give just HTML syntax without the “/”. Everyone 
who uses XHTML should be expected to know what to do.

And it would be even simpler to remove all that advice on using “this 
icon”. The validator should simply report the errors it has detected, or 
say “No errors detected.” Suggestions to use some icons are just a 
distraction and bad advice; the wording about “/” is just a minor 
addition to the confusion.

Yucca

Received on Sunday, 8 March 2015 21:28:30 UTC