- From: Philip Taylor <philip@zaynar.demon.co.uk>
- Date: Tue, 17 Jul 2007 13:12:04 +0100
- To: Robert Burns <rob@robburns.com>
- CC: public-html@w3.org
Robert Burns wrote:
> On Jul 16, 2007, at 10:00 PM, Robert Burns wrote:
>> On Jul 16, 2007, at 9:44 PM, Philip Taylor wrote:
>>> Robert Burns wrote:
>>>> First, I think there's a danger of going into too much detail
>>>> regarding optional tags. The only things I think might need to be
>>>> in an introductory section (maybe) are:
>>>> 1) that empty elements must have their closing tag omitted unless
>>>> an author uses the xml-style self-closing tag (e.g., <link />).
>>>> 2) that empty elements must be closed when using the xml
>>>> serialization: i..e., either (<link></link> or <link />)
>>>> So to avoid this confusion and simplify things, it may make sense
>>>> to always recommend (or as far as this introduction goes, just
>>>> gloss- over the difference so that authors use) the self-closing tag
>>>> for empty elements.
>>>
>>> Teaching authors about XML-style self-closing tags is also a cause of
>>> confusion.
>>
>> Just to clarify, when I wrote "empty elements", I meant canonically
>> empty elements (i.e., elements required to be empty). Yes, I agree
>> that encouraging the shortcut everywhere be a bad thing for the
>> text/html serialization. I don't think any of your following examples
>> relate to that.
>
> What I meant to say here is that none of the examples relate to the
> elements with empty content models and that the examples you listed are
> specifically elements that do not have empty content models. I think we
> if advised authors to use the self-closing tag on elements with empty
> content models (and highlighted how the chapter shows those at the
> beginning of each section/subsection), that would be a simple guideline
> to follow (for an introductory section). Getting into more detail than
> that right there (e.g., discussing differences between xml and non-xml
> serializations) would be counter-productive.
http://www.w3.org/TR/xhtml1/#guidelines already gives that advice:
"Include a space before the trailing / and > of empty elements,
e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />. Also, use
the minimized tag syntax for empty elements, e.g. <br /> ..."
"Given an empty instance of an element whose content model is not
EMPTY (for example, an empty title or paragraph) do not use the
minimized form (e.g. use <p> </p> and not <p />)."
The point of the examples is that people half follow that advice, but
then they get confused between real XML and HTML-that-looks-like-XML,
and they forget the distinction between empty content model vs empty
content, and they end up writing buggy HTML. Advising authors (whether
in this document or elsewhere) to write HTML-that-looks-like-XML will
only increase that confusion and result in more broken HTML documents.
> Take care,
> Rob
--
Philip Taylor
philip@zaynar.demon.co.uk
Received on Tuesday, 17 July 2007 12:12:35 UTC