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 23368 - Clarify that it is permitted to declare the namespace of the xlink: prefix on the <html> element.
Summary: Clarify that it is permitted to declare the namespace of the xlink: prefix on...
Status: RESOLVED LATER
Alias: None
Product: HTML WG
Classification: Unclassified
Component: CR HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Robin Berjon
QA Contact: HTML WG Bugzilla archive list
URL: http://www.w3.org/TR/html5/dom.html#g...
Whiteboard:
Keywords:
Depends on:
Blocks: 23372
  Show dependency treegraph
 
Reported: 2013-09-26 14:13 UTC by Leif Halvard Silli
Modified: 2013-10-30 23:33 UTC (History)
2 users (show)

See Also:


Attachments

Description Leif Halvard Silli 2013-09-26 14:13:47 UTC
CURRENTLY: The section on global attributes states:

]] 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". This does not apply to XML documents.
 NOTE: In HTML, the xmlns attribute has absolutely no effect. It is basically a talisman. It is allowed merely to make migration to and from XHTML mildly easier. When parsed by an HTML parser, the attribute ends up in no namespace, not the "http://www.w3.org/2000/xmlns/" namespace like namespace declaration attributes in XML do.
[[
  (http://www.w3.org/TR/html5/dom.html#global-attributes)


PROPOSAL: Add a statement saying roughly this:

]] In HTML documents, elements in the HTML namespace may also have an xmlns:xlink attribute, if, and only if, it has the exact value "http://www.w3.org/1999/xlink". Preferrably, it should be declared on the root element.
 NOTE: Like for the xmlns atteribute, it has no effect in HTML. It is allowed partly to make migration to and from XHTML midly easier and partly because it (in the XHTML serialisation) is an author convenience as it frees authors from having to declare it on each and every foreign content context (svg or math elements). As the HTML syntax doesn't need it to be delclared at all, the permission to declare it on the HTML root element makes the authoring similar for the two syntaxes.
[[


Example:

    <html xmlns:xlink="http://www.w3.org/1999/xlink">

Being allowed to declare the xlink prefix on the root element has the advantage that it is not necessary to remember to declare it on the root element of the <svg> or <math> element. It is thus a convenience that simplifies authoring.

The polyglot markup specification already permits this usage, on the assumption that HTML5 already permits it. But the NU validator does not allow it.

The HTML5 spec says, about the HTML syntax (thus: not about the XHTML syntax): http://www.w3.org/TR/html5/syntax.html#attributes-0

]]
   [ … snip … ]
   xlink | XMLNS namespace | xmlns:xlink
   No other namespaced attribute can be expressed in the HTML syntax.
[[

The disadvantage of allowing declaration on the root element is that it could perhaps lead authors to auto insert the declaration even when not needed. Other than that, I don’t think there are other disadvantages.
Comment 1 Leif Halvard Silli 2013-09-26 16:31:15 UTC
One, perhaps negative, issue to consider:

For <svg xmlns:xlink="http://www.w3.org/1999/xlink">, then one can use the following CSS selector to select the element - in both HTML and in XHTML:

   [*|xlink]{ … }

But for <html xmlns:xlink="http://www.w3.org/1999/xlink">, one would have to use one selector for HTML, and another selector for XHTML:

     [xlink],     /* for HTML */
   [*|xlink]{ … } /* for XML  */
Comment 2 Leif Halvard Silli 2013-09-27 17:46:23 UTC
Please consider this bug for 5.1 if it fails to meet criteria for 5.0.
Comment 3 Robin Berjon 2013-10-30 17:05:34 UTC
I understand that this may be convenient, but I have never heard a user request for it and checking with people who write validators it's not something they've been asked about either.

I think that this is in the "perhaps nice to have" department, and the effort seems to be greater than warranted by the usage.

We can keep this as something to look at in the 5.1 time frame, while we're not busy shipping 5.0, but I really wouldn't block anything on it. I recommend you remove the blocker and revisit this issue later.
Comment 4 Leif Halvard Silli 2013-10-30 23:33:14 UTC
(In reply to Robin Berjon from comment #3)
> I understand that this may be convenient, but I have never heard a user
> request for it

In my view, it is *pretty* common to declare prefixes on the root element. It is more like it is uncommon to declare them anywhere else. Just think of RDFa, or? Also, I have seen many prefixed elements whose prefix was declared on the non-prefixed root element.

> and checking with people who write validators it's not
> something they've been asked about either.

The validator accepts RDFa prefixes declared on the root element.

> I think that this is in the "perhaps nice to have" department, and the
> effort seems to be greater than warranted by the usage.

The argument that woudl be simplest for myself to accept would be if it was problematic to put it on the root element. Disadvnatages. Does it make things less robust, for instance? To answer my own question: Perhaps, yes. E.g. it would cause the SVG to not work if copied and pasted into an application/xhtml+xml document. May be it would be worth stating, at least in Polyglot Markup, that xlink: MUST be declared in the specific root element?

> We can keep this as something to look at in the 5.1 time frame, while we're
> not busy shipping 5.0, but I really wouldn't block anything on it. I
> recommend you remove the blocker and revisit this issue later.

OK. For polyglot, it was most pressing to get clear about what HTML5 *currently* says, as the draft is saying xlink: *can* be declared on <html> - and we were not sure why me mad it say so.

Anyway: I mark this bug as “Resolved, Later”, then, OK?