W3C home > Mailing lists > Public > public-html@w3.org > December 2010

Re: Hoisting <base> into <head>

From: L. David Baron <dbaron@dbaron.org>
Date: Tue, 7 Dec 2010 23:03:54 -0800
To: Henri Sivonen <hsivonen@iki.fi>
Cc: public-html <public-html@w3.org>
Message-ID: <20101208070354.GA29337@pickering.dbaron.org>
On Tuesday 2010-09-07 04:16 -0700, Henri Sivonen wrote:
> HTML5 says that only the first <base href> that is a child of
> <head> is taken into account for overriding the base URL and the
> first <base target> that is the child of <head> is taken into
> account for the default browsing context target. HTML5 also
> doesn't make the parser hoist <base> into <head>.
> Both these behaviors have been implemented in Gecko in the Firefox
> 4.0 product cycle. The combination of these two features is
> causing Web compatibility problems. Having only one of them
> wouldn't. Before the HTML5 parser was enabled in Gecko, we had a
> situation where Gecko only consider <base> in <head> but the
> parser hoisted misplaced <base> into <head>. Currently, Chromium
> nightlies don't hoist <base> but consider <base> outside <head>.

A related issue that you don't address, though, is what happens when
links within the head are before the base element, or between
multiple base elements.  HTML 4.01 says only:
  # When present, the BASE element must appear in the HEAD section
  # of an HTML document, before any element that refers to an
  # external source. The path information specified by the BASE
  # element only affects URIs in the document where the element
  # appears.
  -- http://www.w3.org/TR/html4/struct/links.html#h-12.4
and gives no implementation conformance requirements. 

HTML5 says though its definition of document base url in
http://dev.w3.org/html5/spec/urls.html#document-base-url that the
base element applies to all of the document, including (through lack
of anything saying otherwise, as far as I can tell) what is before
the base element.  (This recently changed to include all base
elements rather than only those in the head, it appears.)

However, implementations seem to differ on this regard.  Consider,
for example, this test that I just wrote:
It contains three style elements interleaved with two base elements
(style 1, base 1, style 2, base 2, style 3).

In Firefox 3.6, Chromium from late June, and Opera 11 beta, base 1
applies to style 2, and base 2 applies to style 3.

In IE8 and Firefox trunk, base 1 applies to both style 2 and style
3, but not style 1.

HTML5 says (I think) that base 1 should apply to all three style
elements, which doesn't match any of the browsers I tested.

(I was investigating this a little because of a bug report, though I
don't know if any live sites were broken because of it:
https://bugzilla.mozilla.org/show_bug.cgi?id=613612 )

It's not clear to me what is the right thing to do here.


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Wednesday, 8 December 2010 07:04:34 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:07 UTC