[whatwg] Namespaces and tag names in the HTML parser

Peter Occil poccil14 at gmail.com
Wed May 29 16:48:13 PDT 2013


>> The spec for what should happen to that <td> is the first step of
>> http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#parsing-main-intr
>>
>> This case clearly seems like a bug in Gecko: it's treating the <math tr>
>> as if it's an HTML <tr>. That is, it's comparing only the local name (or
>> "tag name" as the spec usually refers to it).

>Right, that's wrong. The spec isn't ambiguous here, it explicitly says
>that the current node must be a <tr> or <html> element, not an element
>with a "tr" or "html" tag name, and <tr> and <html> elements are in the
>HTML namespace (they're even hyperlinked to their definitions).

For some people it might be ambiguous: "while the current node is not a tr
element or an html element"
doesn't refer to a namespace (if one takes only the words, not their
hyperlinks), so some people may believe
that only the tag names of "tr" and "html" are important. (While the HTML
spec states that "except where otherwise stated, all elements defined or
mentioned in this specification are in the HTML namespace", the chance is
high that some people might gloss over that, as I certainly did when I
implemented my HTML parser.)

If you're correct in this case, the words should have been "while the
current node is neither a tr element in the HTML namespace nor an html
element in the HTML namespace".

To avoid confusion, it would be helpful, in each case, to state whether,
say, "a table element" refers to "a table element in the HTML namespace" or
"a table element in any namespace".

(Apologies to Ian, I forgot to reply to the message proper by adding it to 
the list.)

--Peter 




More information about the whatwg mailing list