[whatwg] Namespaces and tag names in the HTML parser

Ian Hickson ian at hixie.ch
Thu Aug 1 15:27:37 PDT 2013

On Thu, 1 Aug 2013, Peter Occil wrote:
> - "Let the current column be the first col element child of the colgroup 
> element" is not considered ambiguous because the "colgroup element" 
> mentioned is understood to be "the colgroup element in question" (see 
> the beginning of the step: "If the current element is a colgroup, follow 
> these substeps:").  On the other hand, the phrase "While the node is a 
> so-and-so element, etc." (and the patterns mentioned in my earlier 
> message) is ambiguous because it is not known beforehand what kind of 
> element is involved.  (Also, ambiguity issues involving "the first col 
> element child" are moot because, as far as I can tell, an element named 
> "col" in a namespace other than HTML can't be a direct child of an HTML 
> "colgroup" element.)

Oh it's easy to end up with non-HTML elements in such places:

   var cg = document.createElement('colgroup');
   var c = document.createElementNS('http://example.com/', 'col');

> - The tree construction stage is more generic than other HTML algorithms 
> with respect to namespaces, while most of the rest of the spec deals 
> exclusively with the HTML namespace, making confusion much less likely.

I think it's a mistake to look at the spec this way. As shown above, it's 
easy for non-HTML namespaces to end up in the middle of HTML elements, and 
processing models have to take that into account. When the spec says "the 
first col element child", it has to be an HTML <col> element. Same in the 
parser. There's no difference.

My main concern is that being triply-explicit (we're already doubly 
explicit, given the text in the intro that says this, and the hyperlinks 
from each occurrence of an element name in the parser to the element's 
definition) will make people start wondering why we're explicit in some 
places but not others, and they'll assume there's some meaningful 
difference, and then they'll start making mistakes because of it.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list