Re: Question about new lines [message #175512 is a reply to message #175508] |
Mon, 03 October 2011 12:51 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
Jeff Gaines wrote:
> Jerry Stuckle wrote:
>> Which isn't valid on html - only xhtml or xml.
>
> There seems to be confusion about whether or not the / is optional.
Yes, that only *seems* to be so.
> In reality, of course, all browsers honour it.
Your logic is flawed. You simply cannot know about *all* browsers.
AISB, *some* browsers, perhaps the majority in terms of market share, do not
implement the SGML Declaration for HTML 4.01 [1] properly, which specifies
the SHORTTAG syntax for HTML so that `<br />' is equivalent to `<br>>' in
HTML (that allows, for example `<h1/My Title/' instead of `<h1>My
Title</h1>') [2]. But the W3C Validator [3] does, which is why, e. g.,
<link … rel="…" … />
is _not_ a Valid HTML 4.01 fragment (as `>' would be character data which
is not allowed within the `HEAD' element).
This has led to the *current* HTML5 Working Draft regarding the trailing `/'
between `<' and the corresponding `>' of a start tag as allowed and optional
in the HTML syntax of HTML5 [4,5]. But you SHOULD NOT rely on that
outside of HTML5, perhaps not even in HTML5 until it has become stable.
HTH
PointedEars
___________
[1] <http://www.w3.org/TR/html401/sgml/sgmldecl.html>
[2] <http://www.w3.org/MarkUp/html3/HTMLandSGML.html>
[3] <http://validator.w3.org/>
[4] <http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#start-tags>
[5] <http://www.w3.org/TR/2011/WD-html5-20110525/introduction.html#html-vs-
xhtml>
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
|
|
|