Re: baseURI / xml:base

Anne van Kesteren <[email protected]>
Newsgroups gmane.comp.web.dom.general
Message-ID <CADnb78jwgq3GhzNOFcBZ2JMaVn=Za1iQq9uhoy6VruzzDD8KUw@mail.gmail.com>
On Fri, Aug 9, 2013 at 2:37 PM, Boris Zbarsky <[email protected]> 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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.