Another possible compromise re namespaces in HTML

How about this - I think it allows people wanting to use namespaced
content in HTML a great deal of flexibility, yet without making things
too complicated for parsers.

1. In the HTML serialisation, xmlns:* attributes may be used to declare
any namespaces. The default xmlns attribute cannot be bound to anything
other than the HTML namespace.

2. The namespace URIs which HTML supports "out of the box" (e.g. SVG,
XML, HTML itself) do not have to be declared, and may not be declared
using any prefix other than their standard prefix as specified by the
HTML syntax spec.  Those standard prefixes cannot be used with other
namespace URIs. There is precedent for such a rule - in XML, the prefix
'xml' and namespace URI 'http://www.w3.org/XML/1998/namespace' may only
be bound to each other. Such non-conformant namespace declarations would
be ignored.

3. Namespaced attributes (foo:bar="baz") are conformant, but validators
*may* issue warnings about them.

4. Within so-called foreign content (e.g. SVG), namespaced elements are
conformant, but validators *may* issue warnings about them. Elsewhere,
namespaced elements are non-conformant. Namespaced elements are parsed
the same way any other unknown elements are.

5. People wishing to use namespaced elements outside foreign content are
instead advised to use CURIE values within @role. It may be useful for
browsers to expose the contents of @role as an array in the DOM with
CURIE prefixes already expanded out.

6. Namespace-aware DOM functions (getAttributeNS, etc) should work.

I can't imagine there's very much existing content in the wild that
would break under these rules. The aforementioned example of Creative
Commons licenses within SVG would work and be considered conformant; the
Google Jotspot example would work but be considered non-conformant.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Wednesday, 25 November 2009 09:33:51 UTC