[whatwg] <base> versus xml:base

Thomas Broyer t.broyer at gmail.com
Wed Mar 14 03:40:04 PDT 2007


2007/3/14, Anne van Kesteren:
> On Tue, 13 Mar 2007 19:15:12 +0100, Asbjørn Ulsberg
> <asbjorn at tigerstaden.no> wrote:
> >> They don't conflict. They are both applied. <base> is the document's
> >> base URI, and xml:base is the base URI of the element it is applied on.
> >
> > What about:
> >
> >    <base href="http://www.example.org/" xml:base="/bar" />
>
> I suppose xml:base="" should affect href="". That would make it consistent
> with
>
>    <img src="..." xml:base="..."/>
>
> at least. Interesting sample.

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?
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).

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

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.

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

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

Just some thoughts…

-- 
Thomas Broyer


More information about the whatwg mailing list