This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10997 - add clear indication of whether an element is singleton or open/close
Summary: add clear indication of whether an element is singleton or open/close
Status: RESOLVED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 enhancement
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-09 07:55 UTC by Jim Michaels
Modified: 2011-08-04 05:06 UTC (History)
7 users (show)

See Also:


Attachments

Description Jim Michaels 2010-10-09 07:55:32 UTC
the current html, xhtml, wml specifications do not seem to give any clear indication of whether an element is a singleton or whether it is open/close style.

everybody writes option, dd, dt, li and similar elements their own way.  some write it <option></option> and some write it <option/> and some write it <option>.  w3schools seems to get this mixed up as well.
and then there's the validators, which have their own idea of how things should be done, for instance, the html5 validator thinks the singleton option element should have open/close style.
please provide clear indication of the tag style with examples and in the description of the element, 

Element Format: open/close
OR
Element Format: singleton

or,

Singleton: yes
OR
Singleton: no



w3schools says that to future proof your html, you should always close your tags.  since they can't even be consistent, I hardly know what to think.

this should clean up a lot of bad HTML in the world.

If you have a more clear wording, I would like to see it.  Why?  because there are a few things that have been a mess for many years, and it's time to clean things up with clarity.
Comment 1 Anne 2010-10-09 10:20:59 UTC
This is already defined in detail in the syntax section of the specification.
Comment 2 Tab Atkins Jr. 2010-10-09 15:21:46 UTC
To be more specific, http://www.whatwg.org/specs/web-apps/current-work/complete/syntax.html#elements-0 defines which elements are "void", that is, elements that don't have an end tag at all.

http://www.whatwg.org/specs/web-apps/current-work/complete/syntax.html#optional-tags defines when you can omit the start or end tags of other elements.
Comment 3 Boris Zbarsky 2010-10-09 15:42:13 UTC
> the html5 validator thinks the singleton option elemen

<option> isn't "singleton".  It contains text that shows up as the user-visible text for the option.  So whoever is writing "<option/>" is very confused.
Comment 4 Jim Michaels 2010-10-10 02:25:40 UTC
this is my point.  why isn't this in the specification where it belongs?
don't you think people go right to the HTML specification first for proper info?
I have never even heard of this page you mention, nor do I know how to get to in in w3c.org.  I hope you see my point.  and I am a software developer.  I am usually good at finding things.

a "void element" means nothing to a person who is not writing the specification.

also, I think there are mistakes in the document you mentioned anyway.  where is optgroup?  I can't submit comments on that document to repair it because I wouldn't know how to begin.  the html5 validator tells me optgroup is a singleton (a void element).

again, my point is, this is the kind of information that belongs in the HTML5 specification.   a one-liner near the top in the specification explaining that a void element means a singleton whereas non-void element means that it has open/close tags would show newbies how to read the specification.  everybody would benefit.

please consider it.  thank you.
Comment 5 Boris Zbarsky 2010-10-10 03:01:15 UTC
> why isn't this in the specification where it belongs?

Uh... it is.  http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-option-element says:

  Content model:
      Text.

So does the W3C copy of the same spec at http://www.w3.org/TR/html5/the-button-element.html#the-option-element

> where is optgroup?

http://www.w3.org/TR/html5/the-button-element.html#the-optgroup-element

and

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-optgroup-element

Both happen to say:

  Content model:
    Zero or more option elements.

> I am usually good at finding things.

Interesting.  The w3.org document above is the second Google hit for "html5 w3c"....  and you didn't find it?

> the html5 validator tells me optgroup is a singleton (a void element).

Really?  Can you please link me to the url of the report that claims this?

> this is the kind of information that belongs in the HTML5 specification.

It IS in the specification.  The "Content model" line says exactly what the children of the element are allowed to be.  For <img>, it says:

  Content model:
      Empty.

as it does for every element you seem to call a "singleton".  Note that I have _never_ heard anyone refer to elements that canot have children as "singletons" before, ever...  

Note that the term "void element", as well as various other stuff that makes the spec easier to read for authors is also in the in-progress web developer guide to HTML5 at http://dev.w3.org/html5/html-author/
Comment 6 Jim Michaels 2010-10-10 05:32:41 UTC
sorry.  I am a little slow on the uptake.  I have been processing these by
looking at emails rather than looking at the bug report itself, which is a
mistake.  I don't usually do this.

would you consider moving this information from the syntax section to the
description of the individual style elements themselves?

at least put in a one-liner blurb near the top saying something like 

"Singleton tags are called void elements in the <a href="link">syntax area</a>
of this document. Open/close tags are tags that are not listed onder the list
of void elements. singleton tags in xhtml and html5 must be closed with a / as
in <input ... /> or <br /> rather than the old method of <br>." 

I don't know if the latter part of this statement is true for html5, but
w3schools is putting forth that to future-proof your html you must close all
your tags.  If this is true, you may as well mention how to do this in the spec
right now, or at least tell them that in html5 it is optional.

please place this or a statement similar to it near the top of the document. 
please do this for the html5 document and the html 4 document and xhtml
documents as well if possible.  it would clear so much up.  even just this one
line.  

The word "Syntax" doesn't hold much meaning for most authors.  I didn't even
know there was a syntax section of the document.  
To be honest, the main place I as an author look is at the top of the document
to see if there are any explanations written there that I need to heed, and the
sections that deal with the tags themselves, and the attributes.  I may
occasionally venture outside of that.

I don't know if you had considered that your target audience might consist of
web authors and developers, but it does.  please consider them a little (one
line of text can make a huge difference in clearing up confusion). 


OK I understand I have been coding my optgroup elements incorrectly now,
because its content is other elements (oops).  the validator didn't like my
open/close optgroup tags with text in them (but then maybe that was the problem).

ok, I'm not perfect at finding things.  I will let you know if my improved code doesn't work well on the validator. if it works correctly I'll shut up about it.
Comment 7 Boris Zbarsky 2010-10-10 13:16:45 UTC
> would you consider moving this information from the syntax section to the
> description of the individual style elements themselves?

Uh... did you look at the links in comment 5?

> the sections that deal with the tags themselves

Which all list exactly what children the tag can have, and whether they can have any at all...
Comment 8 Ms2ger 2010-10-10 19:30:31 UTC
Works for me (and Anne, Tab and Boris).
Comment 9 Michael[tm] Smith 2011-08-04 05:06:14 UTC
mass-moved component to LC1