Re: xmlns in HTML5 (was: Telecon Agenda- Thursday 1500 UTC)

On Thu, 16 Jul 2009, Manu Sporny wrote:
>
> 1. Where is the text that states that xmlns:-based namespace 
> declarations aren't allowed in HTML5 documents? (other than by not 
> saying anything about xmlns:FOO style namespace declarations or not 
> specifying xmlns: as a valid global attribute in HTML5).

# Authors must not use elements, attributes, and attribute values that are 
# not permitted by this specification or other applicable specifications.
 -- http://www.whatwg.org/specs/web-apps/current-work/#semantics-0

# In HTML documents, elements in the HTML namespace may have an xmlns 
# attribute specified, if, and only if, it has the exact value 
# "http://www.w3.org/1999/xhtml". 
 -- http://www.whatwg.org/specs/web-apps/current-work/#global-attributes


> 2. Is it true that xmlns and xmlns:XYZ namespace declarations are 
> allowed in XHTML5? My reading of the HTML5 spec is that they are 
> allowed.

Yes, because XHTML5 is an application of XML and Namespaces in XML, which 
allows those declarations. (It would in fact be a layer violation for 
XHTML5 to make any statements about whether "xmlns" attributes are allowed 
in XHTML5. This is similar to how the HTML5 spec doesn't say what DOCTYPE 
you're allowed to use in XHTML5 -- it's up to the XML spec.)


> 3. What triggers the html5lib parser into XHTML5 mode? Is it only the 
> server document Content-Type set to "application/xml" or 
> "application/xhtml+xml"? Would this <meta http-equiv="Content-Type" 
> content="application/xml"> trigger the html5lib parser into XHTML5 mode? 
> The section on Encoding Declaration State[1] seems to indicate that 
> "text/html" is the only valid value for "http-equiv"?

I don't know about html5lib, but in the HTML5 spec, the only thing that 
decides whether a stream of bytes is "XHTML5" or "HTML5" is the MIME type. 
There's no way to send XHTML5 as text/html, because if you send it as 
text/html, it is by definition HTML5. (This will probably be made more 
explicit once we update the relevant MIME type registrations.)


> 4. If xmlns:-based namespace declarations are not allowed in HTML5, are 
> they still accessible via the HTML5 DOM? Does the HTML5 DOM filter out 
> "invalid" attributes? There is no text that I could find that specifies 
> what is and isn't included in the HTML5 DOM.

The text that defines what ends up in the DOM is the parser:

   http://www.whatwg.org/specs/web-apps/current-work/#parsing

There are some complications around SVG and MathML (foreign content) in 
text/html, but ignoring those, "xmlns" attributes are handled the same as 
any unknown attributes in text/html.

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

Received on Thursday, 16 July 2009 05:21:33 UTC