Base URIs and Browsers

Just an FYI, but I've been testing the xml:base support in various
browsers (Safari, Chrome, and Firefox) with some interesting results.
In theory, according to the HTML5 specification, the "base URI"
property of the of the element must be used to resolve URI values [1].
 For example, that means an 'img' element with an xml:base attribute
should load the image relative to the value of the base URI derived
from the xml:base attribute.

Firefox does this properly when an 'img' element either has an
xml:base attribute in the original markup or the attribute was set via
Javascript on the element before it is added to the DOM.  Firefox does
not do this properly when the xml:base attribute is added or changed
once the image is in the DOM.  The HTML5 specification says nothing
about this kind of behavior and I suspect it an oversight that should
be corrected.

Neither of the WebKit based browsers (Safari or Chrome) that I tested
do this correctly.  They derive the base URI properly but this base
URI has no affect on the image location.  This is a bug according to
the HTML5 specification.

This all becomes important if you expected content retrieved via
XInclude to work properly.  In theory, a chunk of XHTML included
should be able to have relative references to ancillary resources.
This will work during the initial include in Firefox but not in any
WebKit-based browser.  I haven't tested IE yet but I will do so.

What does this have to do with the XML Processing Model?  Well, I
think we need to be clear about the expectations we are putting on
browser vendors.  If xml:base works properly, XInclude will work quite
well.  Then, regardless of whether a XInclude is invoked automatically
by the browser or via an application in Javascript, the correct thing
will happen with intrinsic vocabularies like XHTML or SVG.

[1] http://dev.w3.org/html5/spec/Overview.html#resolving-urls
[2] http://dev.w3.org/html5/spec/Overview.html#the-img-element

-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Thursday, 9 June 2011 11:23:49 UTC