W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2013

Re: baseURI / xml:base

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 09 Aug 2013 10:02:57 -0400
Message-ID: <5204F691.8000503@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: "www-dom@w3.org" <www-dom@w3.org>
On 8/9/13 9:51 AM, Anne van Kesteren wrote:
> Interesting. It doesn't in other browsers:
> http://software.hixie.ch/utilities/js/live-dom-viewer/
> <!DOCTYPE html><base href=test>.<script>
> w(document.body.firstChild.baseURI);
> w(document.body.firstChild.cloneNode().baseURI)
> </script>

I think this is just WebKit being buggy.  Consider the slightly more 
extended testcase at 
http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2439 which 
looks like this:

<!DOCTYPE html><base href=test>.<script>
var y = document.body.firstChild;
var x = document.body.firstChild.cloneNode();

Here WebKit reports the document base URI, then the empty string, then 
null, then the document base URI.  That second "empty string" bit in 
particular shows that this is just a bug in WebKit's baseURI getter, not 
anything to do with cloneNode.

Per spec, for whatever that's worth and if we ignore the xml:base bits 
we have:

   Given an element, the element's base URL is the base URI of the
   element, as defined by the XML Base specification, with the base
   URI of the document entity being defined as the document base URL
   of the Document that owns the element. [XMLBASE]

which is pretty clearly using the base URI of the ownerDocument, and is 
in no way dependent on whether the element is in the DOM (in fact, the 
only dependency on position in the DOM comes from xml:base).

Received on Friday, 9 August 2013 14:03:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:03 UTC