[whatwg] <base> elements, again

Henri Sivonen hsivonen at iki.fi
Tue Jan 25 00:09:55 PST 2011


Jonas Sicking wrote:
> On Mon, Jan 24, 2011 at 10:33 AM, Boris Zbarsky <bzbarsky at mit.edu>
> wrote:
> > On 1/24/11 11:23 AM, Henri Sivonen wrote:
> >>>
> >>> Why did/does this markup work in other UAs? Or does it not?
> >>
> >> According to the Chromium bugs about Unicenter, Unicenter doesn't
> >> work in
> >> Opera or in WebKit-based browsers--only in Firefox and IE.
> >
> > Exciting. :(
> >
> >> When <base target> follows the <a>, IE6 ignores the target, because
> >> IE6
> >> honors the most recent <base>.
> >
> > That's the Gecko 1.9.2 and earlier behavior as well, right?

For the level of detail that's relevant here, yes. (In IE6, <base> becomes a container that doesn't close until the end of the document. In Gecko 1.9.2, <base> is empty but takes effect on the nodes that follow it in the tree order.)

> >> IE7 and later ignore <base> outside <head>, so a <base> following
> >> an <a>
> >> gets ignored due to that reason.
> >
> > Right, and that breaks other sites, which is why we changed away
> > from that
> > behavior...
> >
> > I can't say I like the IE6/old-Gecko behavior, but it may be the
> > most
> > web-compatible. :(
> 
> So how does IE7/8 deal with the sites which broke for us when we
> didn't honor <base> outside <head>? (United.com, right?)

So there are two distinct things here: <base href> and <base target>.

United.com is <base href>. It works in IE7, because <base href> ends up being in head, because the element before it that makes Firefox 4 / Chrome 8 / spec break out of head is of the form <foo:bar />, where the colon makes IE7 treat /> as self-closing syntax. Furthermore, apparently stuff with colons doesn't break out of head in IE7. United.com is on the Microsoft-maintained blacklist of sites that need to be in the EmulateIE7 mode, so the parsing changes for <foo:bar /> in IE9 don't apply.

Unicenter and hyperlatex are <base target>. Hyperlatex output is broken in IE7 and later. In Unicenter, the <base target> is after the <a href>, so the target doesn't take effect in IE6, because the target comes later. In IE7, the target doesn't take effect, because the target isn't given in <head>.

(Note that IE quirks mode, which Unicenter is in, does honor <base target> in <head> for the evaluation context of javascript: URLs, so this isn't about that.)

> I'd really like to avoid going back to Gecko/IE6 behavior. It's bad
> both for browsers and authors.

I agree.

Since Unicenter reportedly uses an EmulateIE7 X-UA-Compatible, presumably the product was still being maintained when IE8 was released. Maybe there's a slight chance that they could take out the bogus <base target> if asked nicely. Is it known if CA Technologies can push automatic updates to their Unicenter customers?

One 100% browser-side option (that I don't like but am mentioning for completeness) that would make both Unicenter and hyperlatex work without introducing code for keeping track of multiple <base target>s in the tree order would be limiting <base target> to <head> in the quirks mode but honoring the first <base target> in the other modes.

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/



More information about the whatwg mailing list