Re: baseURI / xml:base

On Fri, Aug 9, 2013 at 2:37 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 8/9/13 9:07 AM, Anne van Kesteren wrote:
>> Cloning any node (e.g. Text or Element) will copy the baseURI.
>
> Er... it will?  I don't see any code to that effect, other than the obvious:
> the baseURI getter considers the owner document, so just cloning a node
> (which preserves the ownerDocument) will give you a node with the same base
> URI: that of the document.

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>

Gives null for the clone in Safari/Chrome. But given that in the
following dolly still points to the same location, that might very
well be a bug:

<!DOCTYPE html><base href=test><a href=x>x</a><script>
w(document.body.firstChild.baseURI)
var dolly =document.body.firstChild.cloneNode(true)
w(dolly.baseURI)
w(dolly.getAttribute("href"))
w(dolly.href)
</script>


-- 
http://annevankesteren.nl/

Received on Friday, 9 August 2013 13:52:22 UTC