[whatwg] <base> versus xml:base

Asbjørn Ulsberg asbjorn at tigerstaden.no
Wed Mar 14 11:19:52 PDT 2007

On Wed, 14 Mar 2007 11:40:04 +0100, Thomas Broyer <t.broyer at gmail.com>  

> How about this variation:
> <head xml:base="bar/">
> <base href="foo/" />
> </head>
> Is the base at href resolved to absolute using head at xml:base or not?

I'd say it is. At least according to XML Base. The HTML specification can  
of course state otherwise, but the smartest thing to do would be to not  
break 'xml:base' processing rules in HTML, even if <base> is a special  
case element.

> If it is, then when looking at links inside head, relative URIs are
> resolved using a base of "bar/foo/bar/" (taking head at xml:base into
> account twice: once to resolve base at href, which sets the document's
> base URI, and then relative to that base URI to resolve link at href's).

Hm, that sounds weird. I'd say once base at href is resolved (taking into  
account the parent xml:base URI), then that's final. Any xml:base's after  
<base>'s presence will override the base, but I don't see a reason for  
applying xml:base twice. Since <base> is a special case element that  
magically affects all URI's in the document, I'd say it works like that  
even when combined with 'xml:base'.

> If it is not, then <base> is in violation of the xml:base spec AFAICT.

It's even worse if 'xml:base' doesn't apply to <base> at all, but I'd say  
apply the parent base URI, then apply that URI to all elements in the  
document (until another 'xml:base' is encountered).

> I'd personally only allow absolute URI references in base at href.


> We still have to cope with legacy content which uses a relative URI,
> but then they're likely not XHTML, so xml:base is simply ignored.

I'd actually vote for the exclusion of <base> from XHTML entirely. We have  
xml:base, so use that instead.

> This could be solved by saying that if there is an xml:base in scope,
> then <base> is ignored for the whole document.

That's also a solution, yea.

> A quick test with Firefox shows that xml:base is applied but <base>
> seems to be ignored in application/xhtml+xml documents.

Sounds like good behaviour.

Asbjørn Ulsberg     -=|=-    http://virtuelvis.com/quark/
«He's a loathsome offensive brute, yet I can't look away»

More information about the whatwg mailing list