[whatwg] Expected behaviour when a <base> is within an innerHTML fragment

Jorgen Horstink mail at jorgenhorstink.nl
Sun Feb 11 03:37:50 PST 2007

On Feb 11, 2007, at 12:01 PM, Geoffrey Sneddon wrote:

> To take this from a discussion last month on atom-syntax:
> What is meant to happen if you set innerHTML of a <div> where the  
> set value has both a <base> and an <a>?

first of all the <base> element can only be inserted in HTML  
documents. The spec states that there can only be one <base> element.  
The <base> element must  be used before any elements that use  
relative URI's.

If the insertion mode is "in body" handle the token as follows:
       A start tag token whose tag name is one of: "base", "link",  
"meta", "title"
       Parse error. Process the token as if the insertion mode had  
been "in head". [1]

So inserting a <base> element in the body results in a parse error.

[1] http://www.whatwg.org/specs/web-apps/current-work/#how-to0

> - Geoffrey Sneddon

More information about the whatwg mailing list