W3C home > Mailing lists > Public > public-webapi@w3.org > March 2006

Re: ACTION-61: text for embedding part of the Window object

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 06 Mar 2006 10:49:47 -0600
Message-ID: <440C682B.8030709@mit.edu>
CC: "Web APIs WG (public)" <public-webapi@w3.org>

Another question on window.name.  Consider the following HTML:

<html>
<head><script>
function doit() {
   document.getElementById("x").setAttribute("name", "y");
   alert(window.frames[0].name);
}
</script></head>
<body onload="doit()">
<iframe name="x" id="x">
</iframe>
</html>

When I load this, I get:

   Gecko: 'x'
   khtml: 'x'
   Opera: 'y'

If I modify my onload handler as follows:

function doit() {
   var node = document.getElementById("x");
   node.setAttribute("name", "y");
   node.parentNode.removeChild(node);
   document.body.appendChild(node);
   alert(window.frames[0].name);
}

Then I get:

   Gecko: 'y'
   khtml: 'x'
   Opera: undefined

Oh, and in future versions of Gecko I may well end up getting 'x' as well, 
unless we take special pains to implement a different behavior.

I don't know what IE does on these testcases, but it'd be interesting to find out.

Not sure what, if anything, can be specced here, but....

-Boris
Received on Monday, 6 March 2006 16:50:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:53 GMT